What is the difference between the functions of the exec family of system calls like exec and execve?

前端 未结 7 1004
南笙
南笙 2020-12-13 06:17

I have been following a system programming course recently and I came through the system calls exec() and execve(). So far I cannot find a

7条回答
  •  情深已故
    2020-12-13 07:15

    Since all of these function belongs to exec() family, let me differentiate according to extra characters with the meanings,

    1.execve():

    p : not present => name of the program to run will be taken from pathname

    v : present => argument will be passed as array

    e : present => environment will be taken from envp argument

    2.execle():

    p : not present => name of the program to run will be taken from pathname

    l : present => argument will be passed as list

    e : present => environment will be taken from envp argument

    3.execlp():

    p : present => name of the program to run will be taken from filename specified or system will search for program file in PATH variable.

    l : present => argument will be passed as list

    e : not present => environment will be taken from caller's environ

    4.execvp():

    p : present => name of the program to run will be taken from filename specified or system will search for program file in PATH variable.

    v : present => argument will be passed as array

    e : not present => environment will be taken from caller's environ

    5.execv():

    p : not present => name of the program to run will be taken from pathname

    v : present => argument will be passed as array

    e : not present => environment will be taken from caller's environ

    6.execl():

    p : not present => name of the program to run will be taken from pathname

    l : present => argument will be passed as list

    e : not present => environment will be taken from caller's environ

提交回复
热议问题