]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man2/execve.2
execve.2, setfsgid.2, setfsuid.2, splice.2, fopen.3, malloc_trim.3, posix_memalign...
[thirdparty/man-pages.git] / man2 / execve.2
index aaab06d47e77e998b2f1cc670093135db9b8aa9d..119af8d007185d36d0c700e2a09f412db00e7ec8 100644 (file)
 .\" 2007-09-14 Ollie Wild <aaw@google.com>, mtk
 .\"     Add text describing limits on command-line arguments + environment
 .\"
-.TH EXECVE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
+.TH EXECVE 2 2019-05-09 "Linux" "Linux Programmer's Manual"
 .SH NAME
 execve \- execute program
 .SH SYNOPSIS
 .B #include <unistd.h>
 .PP
-.BI "int execve(const char *" filename ", char *const " argv "[], "
+.BI "int execve(const char *" pathname ", char *const " argv "[], "
 .br
 .BI "           char *const " envp []);
 .SH DESCRIPTION
 .BR execve ()
-executes the program pointed to by \fIfilename\fP.
-\fIfilename\fP must be either a binary executable, or a script
+executes the program referred to by \fIpathname\fP.
+This causes the program that is currently being run by the calling process
+to be replaced with a new program, with newly initialized stack, heap,
+and (initialized and uninitialized) data segments.
+.PP
+\fIpathname\fP must be either a binary executable, or a script
 starting with a line of the form:
 .PP
 .in +4n
@@ -90,8 +94,8 @@ If the current program is being ptraced, a \fBSIGTRAP\fP signal is sent to it
 after a successful
 .BR execve ().
 .PP
-If the set-user-ID bit is set on the program file pointed to by
-\fIfilename\fP,
+If the set-user-ID bit is set on the program file referred to by
+\fIpathname\fP,
 then the effective user ID of the calling process is changed
 to that of the owner of the program file.
 Similarly, when the set-group-ID
@@ -305,7 +309,7 @@ The
 .I interpreter
 must be a valid pathname for an executable file.
 If the
-.I filename
+.I pathname
 argument of
 .BR execve ()
 specifies an interpreter script, then
@@ -314,7 +318,7 @@ will be invoked with the following arguments:
 .PP
 .in +4n
 .EX
-\fIinterpreter\fP [optional-arg] \fIfilename\fP arg...
+\fIinterpreter\fP [optional-arg] \fIpathname\fP arg...
 .EE
 .in
 .PP
@@ -383,8 +387,12 @@ stack size.
 ensures that the new program always has some stack space.)
 .\" Ollie: That doesn't include the lists of pointers, though,
 .\" so the actual usage is a bit higher (1 pointer per argument).
+Additionally, the total size is limited to 3/4 of the value
+of the kernel constant
+.B _STK_LIM
+(8 Mibibytes).
 Since Linux 2.6.25,
-the kernel places a floor of 32 pages on this size limit,
+the kernel also places a floor of 32 pages on this size limit,
 so that, even when
 .BR RLIMIT_STACK
 is set very low,
@@ -411,7 +419,7 @@ is too large.
 .TP
 .B EACCES
 Search permission is denied on a component of the path prefix of
-.I filename
+.I pathname
 or the name of a script interpreter.
 (See also
 .BR path_resolution (7).)
@@ -437,7 +445,7 @@ resource limit (see
 For a more detailed explanation of this error, see NOTES.
 .TP
 .B EFAULT
-.I filename
+.I pathname
 or one of the pointers in the vectors
 .I argv
 or
@@ -459,7 +467,7 @@ An ELF interpreter was not in a recognized format.
 .TP
 .B ELOOP
 Too many symbolic links were encountered in resolving
-.I filename
+.I pathname
 or the name of a script or ELF interpreter.
 .TP
 .B ELOOP
@@ -474,7 +482,7 @@ the error produced for this case was
 The per-process limit on the number of open file descriptors has been reached.
 .TP
 .B ENAMETOOLONG
-.I filename
+.I pathname
 is too long.
 .TP
 .B ENFILE
@@ -482,7 +490,7 @@ The system-wide limit on the total number of open files has been reached.
 .TP
 .B ENOENT
 The file
-.I filename
+.I pathname
 or a script or ELF interpreter does not exist, or a shared library
 .\" FIXME but see http://sourceware.org/bugzilla/show_bug.cgi?id=12241
 needed for the file or interpreter cannot be found.
@@ -497,7 +505,7 @@ Insufficient kernel memory was available.
 .TP
 .B ENOTDIR
 A component of the path prefix of
-.I filename
+.I pathname
 or a script or ELF interpreter is not a directory.
 .TP
 .B EPERM
@@ -551,7 +559,7 @@ The result of mounting a filesystem
 varies across Linux kernel versions:
 some will refuse execution of set-user-ID and set-group-ID
 executables when this would
-give the user powers she did not have already (and return
+give the user powers they did not have already (and return
 .BR EPERM ),
 some will just ignore the set-user-ID and set-group-ID bits and
 .BR exec ()
@@ -749,7 +757,7 @@ main(int argc, char *argv[])
     int j;
 
     for (j = 0; j < argc; j++)
-        printf("argv[%d]: %s\\n", j, argv[j]);
+        printf("argv[%d]: %s\en", j, argv[j]);
 
     exit(EXIT_SUCCESS);
 }
@@ -774,7 +782,7 @@ main(int argc, char *argv[])
     char *newenviron[] = { NULL };
 
     if (argc != 2) {
-        fprintf(stderr, "Usage: %s <file\-to\-exec>\\n", argv[0]);
+        fprintf(stderr, "Usage: %s <file\-to\-exec>\en", argv[0]);
         exit(EXIT_FAILURE);
     }
 
@@ -833,7 +841,7 @@ argv[4]: world
 .BR fork (2),
 .BR get_robust_list (2),
 .BR ptrace (2),
-.BR execl (3),
+.BR exec (3),
 .BR fexecve (3),
 .BR getopt (3),
 .BR system (3),