OSDN Git Service

(split) LDP: Update original to LDP v3.65
[linuxjm/LDP_man-pages.git] / original / man2 / execve.2
index 6806ded..5525b43 100644 (file)
@@ -1,8 +1,7 @@
-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
 .\" and Copyright (c) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
@@ -22,6 +21,7 @@
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
 .\" Modified by Michael Haardt <michael@moria.de>
 .\" Modified 1993-07-21 by Rik Faith <faith@cs.unc.edu>
@@ -34,7 +34,7 @@
 .\" 2007-09-14 Ollie Wild <aaw@google.com>, mtk
 .\"     Add text describing limits on command-line arguments + environment
 .\"
-.TH EXECVE 2 2012-05-04 "Linux" "Linux Programmer's Manual"
+.TH EXECVE 2 2014-01-08 "Linux" "Linux Programmer's Manual"
 .SH NAME
 execve \- execute program
 .SH SYNOPSIS
@@ -62,7 +62,7 @@ By convention, the first of these strings should contain the filename
 associated with the file being executed.
 \fIenvp\fP is an array of strings, conventionally of the form
 \fBkey=value\fP, which are passed as environment to the new program.
-Both \fIargv\fP and \fIenvp\fP must be terminated by a NULL pointer.
+Both \fIargv\fP and \fIenvp\fP must be terminated by a null pointer.
 The argument vector and environment can be accessed by the
 called program's main function, when it is defined as:
 
@@ -83,7 +83,7 @@ after a successful
 
 If the set-user-ID bit is set on the program file pointed to by
 \fIfilename\fP,
-and the underlying file system is not mounted
+and the underlying filesystem is not mounted
 .I nosuid
 (the
 .B MS_NOSUID
@@ -179,6 +179,13 @@ The
 .B PR_SET_KEEPCAPS
 flag is cleared.
 .IP *
+(Since Linux 2.4.36 / 2.6.23)
+If a set-user-ID or set-group-ID program is being executed,
+then the parent death signal set by
+.BR prctl (2)
+.B PR_SET_PDEATHSIG
+flag is cleared.
+.IP *
 The process name, as set by
 .BR prctl (2)
 .B PR_SET_NAME
@@ -186,6 +193,13 @@ The process name, as set by
 .IR "ps\ \-o comm" ),
 is reset to the name of the new executable file.
 .IP *
+The
+.B SECBIT_KEEP_CAPS
+.I securebits
+flag is cleared.
+See
+.BR capabilities (7).
+.IP *
 The termination signal is reset to
 .B SIGCHLD
 (see
@@ -276,13 +290,15 @@ where
 is the series of words pointed to by the
 .I argv
 argument of
-.BR execve ().
+.BR execve (),
+starting at
+.IR argv [1].
 
 For portable use,
 .I optional-arg
 should either be absent, or be specified as a single word (i.e., it
 should not contain white space); see NOTES below.
-.SS "Limits on size of arguments and environment"
+.SS Limits on size of arguments and environment
 Most UNIX implementations impose some limit on the total size
 of the command-line argument
 .RI ( argv )
@@ -338,7 +354,7 @@ environment space as was provided by Linux 2.6.23 and earlier.
 Additionally, the limit per string is 32 pages (the kernel constant
 .BR MAX_ARG_STRLEN ),
 and the maximum number of strings is 0x7FFFFFFF.
-.SH "RETURN VALUE"
+.SH RETURN VALUE
 On success,
 .BR execve ()
 does not return, on error \-1 is returned, and
@@ -367,11 +383,15 @@ The file or a script interpreter is not a regular file.
 Execute permission is denied for the file or a script or ELF interpreter.
 .TP
 .B EACCES
-The file system is mounted
+The filesystem is mounted
 .IR noexec .
 .TP
 .B EFAULT
 .I filename
+or one of the pointers in the vectors
+.I argv
+or
+.I envp
 points outside your accessible address space.
 .TP
 .B EINVAL
@@ -422,7 +442,7 @@ A component of the path prefix of
 or a script or ELF interpreter is not a directory.
 .TP
 .B EPERM
-The file system is mounted
+The filesystem is mounted
 .IR nosuid ,
 the user is not the superuser,
 and the file has the set-user-ID or set-group-ID bit set.
@@ -433,7 +453,7 @@ file has the set-user-ID or set-group-ID bit set.
 .TP
 .B ETXTBSY
 Executable was open for writing by one or more processes.
-.SH "CONFORMING TO"
+.SH CONFORMING TO
 SVr4, 4.3BSD, POSIX.1-2001.
 POSIX.1-2001 does not document the #!  behavior
 but is otherwise compatible.
@@ -447,7 +467,7 @@ Set-user-ID and set-group-ID processes can not be
 
 Linux ignores the set-user-ID and set-group-ID bits on scripts.
 
-The result of mounting a file system
+The result of mounting a filesystem
 .I nosuid
 varies across Linux kernel versions:
 some will refuse execution of set-user-ID and set-group-ID
@@ -480,11 +500,13 @@ and white spaces in
 .I optional-arg
 are used to delimit the arguments.
 
-On Linux,
+On Linux, either
 .I argv
+or
+.I envp
 can be specified as NULL,
-which has the same effect as specifying this argument
-as a pointer to a list containing a single NULL pointer.
+which has the same effect as specifying these arguments
+as a pointer to a list containing a single null pointer.
 .B "Do not take advantage of this misfeature!"
 It is nonstandard and nonportable:
 on most other UNIX systems doing this will result in an error
@@ -527,7 +549,7 @@ call.
 Since UNIX V7 both are NULL.
 .SH EXAMPLE
 The following program is designed to be execed by the second program below.
-It just echoes its command-line one per line.
+It just echoes its command-line arguments, one per line.
 
 .in +4n
 .nf
@@ -567,8 +589,8 @@ main(int argc, char *argv[])
     char *newenviron[] = { NULL };
 
     if (argc != 2) {
-       fprintf(stderr, "Usage: %s <file-to-exec>\\n", argv[0]);
-       exit(EXIT_FAILURE);
+        fprintf(stderr, "Usage: %s <file\-to\-exec>\\n", argv[0]);
+        exit(EXIT_FAILURE);
     }
 
     newargv[0] = argv[1];
@@ -620,7 +642,7 @@ argv[3]: hello
 argv[4]: world
 .fi
 .in
-.SH "SEE ALSO"
+.SH SEE ALSO
 .BR chmod (2),
 .BR fork (2),
 .BR ptrace (2),
@@ -631,3 +653,11 @@ argv[4]: world
 .BR environ (7),
 .BR path_resolution (7),
 .BR ld.so (8)
+.SH COLOPHON
+This page is part of release 3.65 of the Linux
+.I man-pages
+project.
+A description of the project,
+and information about reporting bugs,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.