about fork and execve system call

前端 未结 5 1723
难免孤独
难免孤独 2021-02-02 18:11

It is said that fork system call creates a clone of the calling process, and then (usually) the child process issues execve system call to change its i

5条回答
  •  独厮守ぢ
    2021-02-02 18:56

    What does execve stand for?

    The 6 variations of the exec functions in C are are exec{l,v}{,e,p}. See function prototypes below for details.

    Command-line arguments

    • v - Command-line arguments are passed to the function as an array (vector) of pointers.
    • l - Command-line arguments are passed individually (a list) to the function.

    Environment variables (optional)

    • e - An array of pointers to environment variables is explicitly passed to the new process image

    Locate the file to be executed (optional)

    • p - Uses the PATH environment variable to find the file named in the file argument to be executed

    int execl (char const *path, char const *arg0, ...);
    int execle(char const *path, char const *arg0, ..., char const *envp[]);
    int execlp(char const *file, char const *arg0, ...);
    int execv (char const *path, char const *argv[]);
    int execve(char const *path, char const *argv[], char const *envp[]);
    int execvp(char const *file, char const *argv[]);
    

    Source

提交回复
热议问题