1 .\" Copyright (c) 1983 Regents of the University of California.
2 .\" All rights reserved. The Berkeley software License Agreement
3 .\" specifies the terms and conditions for redistribution.
5 .\" @(#)execl.3 6.2 (Berkeley) 4/25/86
7 .TH EXECL 3 "April 25, 1986"
10 execl, execv, execle, execlp, execvp, exec, environ \- execute a file
17 int execl(const char *\fIname\fP, const char *\fIarg0\fP, ..., (char *) NULL)
19 int execv(const char *\fIname\fP, char *const \fIargv\fP[])
21 int execle(const char *\fIname\fP, const char *\fIarg0\fP, ..., (char *) NULL, char *const \fIenvp\fP[])
23 int execlp(const char *\fIname\fP, const char *\fIarg0\fP, ..., (char *) NULL)
25 int execvp(const char *\fIname\fP, char *const \fIargv\fP[])
28 extern char *const *environ;
31 These routines provide various interfaces to the
35 for a description of their properties; only
36 brief descriptions are provided here.
40 overlays the calling process with the named file, then
42 entry point of the core image of the file.
43 There can be no return from a successful exec; the calling
49 is a pointer to the name of the file
54 address null-terminated strings.
60 Two interfaces are available.
62 is useful when a known file with known arguments is
66 are the character strings
67 constituting the file and the arguments;
68 the first argument is conventionally
69 the same as the file name (or its last component).
70 A null pointer argument must end the argument list.
73 functions are variable argument functions. This means that the type
74 of the arguments beyond
76 is not checked. So the null pointer requires an explicit cast to type
78 if not of that type already.)
82 version is useful when the number of arguments is unknown
86 are the name of the file to be
87 executed and a vector of strings containing
89 The last argument string must be followed
92 When a C program is executed,
93 it is called as follows:
98 int main(int \fIargc\fP, char *const \fIargv\fP[], char *const \fIenvp\fP[]);
100 exit(main(\fIargc\fP, \fIargv\fP, \fIenvp\fP));
107 is the argument count
110 is an array of character pointers
111 to the arguments themselves.
114 is conventionally at least one
115 and the first member of the array points to a
116 string containing the name of the file.
119 is directly usable in another
126 is a pointer to an array of strings that constitute
130 Each string consists of a name, an \*(lq=\*(rq, and a null-terminated value.
131 The array of pointers is terminated by a null pointer.
134 passes an environment entry for each global shell variable
135 defined when the program is called.
138 for some conventionally
140 The C run-time start-off routine places a copy of
149 to pass the environment to any subprograms executed by the
155 are called with the same arguments as
159 but duplicate the shell's actions in searching for an executable
160 file in a list of directories.
161 The directory list is obtained from the environment variable
163 Under standard MINIX 3, if a file is found that is executable, but does
164 not have the proper executable header then it is assumed to be
171 to interpret the script.
172 Under Minix-vmd this does not happen, a script must begin with
174 and the full path name of the interpreter if it is to be an
182 If the file cannot be found,
183 if it is not executable,
184 if it does not start with a valid magic number (see
186 if maximum memory is exceeded,
187 or if the arguments require too much space,
189 constitutes the diagnostic;
190 the return value is \-1 and
194 Even for the super-user,
195 at least one of the execute-permission bits must be set for
196 a file to be executed.