Loading...
--- Libc/Libc-262/gen/exec.3
+++ Libc/Libc-498/gen/exec.3
@@ -30,18 +30,18 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)exec.3 8.3 (Berkeley) 1/24/94
-.\" $FreeBSD: src/lib/libc/gen/exec.3,v 1.16 2001/10/01 16:08:50 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/exec.3,v 1.23 2003/09/10 19:24:32 ru Exp $
.\"
.Dd January 24, 1994
.Dt EXEC 3
.Os
.Sh NAME
.Nm execl ,
+.Nm execle ,
.Nm execlp ,
-.Nm execle ,
-.Nm exect ,
.Nm execv ,
-.Nm execvp
+.Nm execvp ,
+.Nm execvP
.Nd execute a file
.Sh LIBRARY
.Lb libc
@@ -49,17 +49,43 @@
.In unistd.h
.Vt extern char **environ ;
.Ft int
-.Fn execl "const char *path" "const char *arg" ...
-.Ft int
-.Fn execlp "const char *file" "const char *arg" ...
-.Ft int
-.Fn execle "const char *path" "const char *arg" ...
-.Ft int
-.Fn exect "const char *path" "char *const argv[]" "char *const envp[]"
-.Ft int
-.Fn execv "const char *path" "char *const argv[]"
-.Ft int
-.Fn execvp "const char *file" "char *const argv[]"
+.Fo execl
+.Fa "const char *path"
+.Fa "const char *arg0"
+.Fa ... /* "(char *)0" */
+.Fc
+.Ft int
+.Fo execle
+.Fa "const char *path"
+.Fa "const char *arg0"
+.Fa ...
+.Fa /*
+.Bk -words
+.Fa "(char *)0" "char *const envp[]" */
+.Ek
+.Fc
+.Ft int
+.Fo execlp
+.Fa "const char *file"
+.Fa "const char *arg0"
+.Fa ... /* "(char *)0" */
+.Fc
+.Ft int
+.Fo execv
+.Fa "const char *path"
+.Fa "char *const argv[]"
+.Fc
+.Ft int
+.Fo execvp
+.Fa "const char *file"
+.Fa "char *const argv[]"
+.Fc
+.Ft int
+.Fo execvP
+.Fa "const char *file"
+.Fa "const char *search_path"
+.Fa "char *const argv[]"
+.Fc
.Sh DESCRIPTION
The
.Nm exec
@@ -75,7 +101,7 @@
is to be executed.
.Pp
The
-.Fa "const char *arg"
+.Fa "const char *arg0"
and subsequent ellipses in the
.Fn execl ,
.Fn execlp ,
@@ -97,10 +123,10 @@
pointer.
.Pp
The
-.Fn exect ,
.Fn execv ,
-and
-.Fn execvp
+.Fn execvp ,
+and
+.Fn execvP
functions provide an array of pointers to null-terminated strings that
represent the argument list available to the new program.
The first argument, by convention, should point to the file name associated
@@ -113,14 +139,12 @@
.Pp
The
.Fn execle
-and
-.Fn exect
-functions also specify the environment of the executed process by following
-the
+function also specifies the environment of the executed process
+by following the
.Dv NULL
-pointer that terminates the list of arguments in the parameter list
-or the pointer to the argv array with an additional parameter.
-This additional parameter is an array of pointers to null-terminated strings
+pointer that terminates the list of arguments in the argument list
+or the pointer to the argv array with an additional argument.
+This additional argument is an array of pointers to null-terminated strings
and
.Em must
be terminated by a
@@ -134,23 +158,31 @@
Some of these functions have special semantics.
.Pp
The functions
-.Fn execlp
-and
-.Fn execvp
+.Fn execlp ,
+.Fn execvp ,
+and
+.Fn execvP
will duplicate the actions of the shell in searching for an executable file
if the specified file name does not contain a slash
.Dq Li /
character.
-The search path is the path specified in the environment by
+For
+.Fn execlp
+and
+.Fn execvp ,
+search path is the path specified in the environment by
.Dq Ev PATH
variable.
If this variable isn't specified,
the default path is set according to the
.Dv _PATH_DEFPATH
definition in
-.Aq paths.h ,
+.In paths.h ,
which is set to
.Dq Ev /usr/bin:/bin .
+For
+.Fn execvP ,
+the search path is specified as an argument to the function.
In addition, certain errors are treated specially.
.Pp
If an error is ambiguous (for simplicity, we shall consider all
@@ -185,11 +217,6 @@
these functions will execute the shell with the path of
the file as its first argument.
(If this attempt fails, no further searching is done.)
-.Pp
-The function
-.Fn exect
-executes a file with the program tracing facilities enabled (see
-.Xr ptrace 2 ) .
.Sh RETURN VALUES
If any of the
.Fn exec
@@ -203,11 +230,14 @@
The shell.
.El
.Sh ERRORS
-.Fn Execl ,
+The
+.Fn execl ,
.Fn execle ,
-.Fn execlp
-and
-.Fn execvp
+.Fn execlp ,
+.Fn execvp ,
+and
+.Fn execvP
+functions
may fail and set
.Va errno
for any of the errors specified for the library functions
@@ -215,10 +245,9 @@
and
.Xr malloc 3 .
.Pp
-.Fn Exect
-and
+The
.Fn execv
-may fail and set
+function may fail and set
.Va errno
for any of the errors specified for the library function
.Xr execve 2 .
@@ -226,7 +255,6 @@
.Xr sh 1 ,
.Xr execve 2 ,
.Xr fork 2 ,
-.Xr ktrace 2 ,
.Xr ptrace 2 ,
.Xr environ 7
.Sh COMPATIBILITY
@@ -249,11 +277,11 @@
.Tn POSIX
standard.
.Pp
-Traditionally, the functions
+Traditionally, the
.Fn execlp
and
.Fn execvp
-ignored all errors except for the ones described above and
+functions ignored all errors except for the ones described above and
.Er ETXTBSY ,
upon which they retried after sleeping for several seconds, and
.Er ENOMEM
@@ -286,11 +314,17 @@
The behaviour was changed to match the behaviour of
.Xr sh 1 .
.Sh STANDARDS
-.Fn Execl ,
+The
+.Fn execl ,
.Fn execv ,
.Fn execle ,
-.Fn execlp
+.Fn execlp ,
and
.Fn execvp
+functions
conform to
.St -p1003.1-88 .
+The
+.Fn execvP
+function first appeared in
+.Fx 5.2 .