int execl (const char *path,
const char *arg,
...);
int execlp (const char *file,
const char *arg,
...);
Running a New Process | 131
int execle (const char *path,
const char *arg,
...,
char * const envp[]);
int execv (const char *path, char *const argv[]);
int execvp (const char *file, char *const argv[]);
int execve (const char *filename,
char *const argv[],
char *const envp[]);
The mnemonics are simple. The l and v delineate whether the arguments are provided
via a list or an array (vector). The p denotes that the user’s full path is searched for the
given file. Commands using the p variants can specify just a filename, so long as it is
located in the user’s path. Finally, the e notes that a new environment is also supplied
for the new process. Curiously, although there is no technical reason for the omission,
the exec family contains no member that both searches the path and takes a new environment.
This is probably because the p variants were implemented for use by shells,
and shell-executed processes generally inherit their environments from the shell.
阅读(804) | 评论(0) | 转发(0) |