1EXEC(3)                    Linux Programmer's Manual                   EXEC(3)
2
3
4

NAME

6       execl, execlp, execle, execv, execvp, execvpe - execute a file
7

SYNOPSIS

9       #include <unistd.h>
10
11       extern char **environ;
12
13       int execl(const char *path, const char *arg, ...
14                       /* (char  *) NULL */);
15       int execlp(const char *file, const char *arg, ...
16                       /* (char  *) NULL */);
17       int execle(const char *path, const char *arg, ...
18                       /*, (char *) NULL, char * const envp[] */);
19       int execv(const char *path, char *const argv[]);
20       int execvp(const char *file, char *const argv[]);
21       int execvpe(const char *file, char *const argv[],
22                       char *const envp[]);
23
24   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
25
26       execvpe(): _GNU_SOURCE
27

DESCRIPTION

29       The  exec() family of functions replaces the current process image with
30       a new process image.  The functions described in this manual  page  are
31       front-ends  for execve(2).  (See the manual page for execve(2) for fur‐
32       ther details about the replacement of the current process image.)
33
34       The initial argument for these functions is the name of a file that  is
35       to be executed.
36
37       The  const  char *arg and subsequent ellipses in the execl(), execlp(),
38       and execle() functions can be thought of  as  arg0,  arg1,  ...,  argn.
39       Together  they  describe  a list of one or more pointers to null-termi‐
40       nated strings that represent the argument list available  to  the  exe‐
41       cuted  program.  The first argument, by convention, should point to the
42       filename associated with the file being executed.  The  list  of  argu‐
43       ments  must be terminated by a null pointer, and, since these are vari‐
44       adic functions, this pointer must be cast (char *) NULL.
45
46       The execv(), execvp(), and execvpe()  functions  provide  an  array  of
47       pointers  to  null-terminated  strings that represent the argument list
48       available to the new  program.   The  first  argument,  by  convention,
49       should  point  to the filename associated with the file being executed.
50       The array of pointers must be terminated by a null pointer.
51
52       The execle() and execvpe() functions allow the caller  to  specify  the
53       environment  of  the  executed program via the argument envp.  The envp
54       argument is an array of pointers to null-terminated strings and must be
55       terminated by a null pointer.  The other functions take the environment
56       for the new process image from the external  variable  environ  in  the
57       calling process.
58
59   Special semantics for execlp() and execvp()
60       The  execlp(),  execvp(), and execvpe() functions duplicate the actions
61       of the shell in searching for an executable file if the specified file‐
62       name does not contain a slash (/) character.  The file is sought in the
63       colon-separated list of directory pathnames specified in the PATH envi‐
64       ronment  variable.   If  this  variable  isn't  defined,  the path list
65       defaults to a list that includes  the  directories  returned  by  conf‐
66       str(_CS_PATH)  (which  typically returns the value "/bin:/usr/bin") and
67       possibly also the current working  directory;  see  NOTES  for