This commit is contained in:
Michael Kerrisk 2007-04-30 09:00:59 +00:00
parent 7fd8a3c9db
commit cd24c68794
1 changed files with 15 additions and 3 deletions

View File

@ -44,7 +44,14 @@ execve \- execute program
.SH DESCRIPTION .SH DESCRIPTION
\fBexecve\fP() executes the program pointed to by \fIfilename\fP. \fBexecve\fP() executes the program pointed to by \fIfilename\fP.
\fIfilename\fP must be either a binary executable, or a script \fIfilename\fP must be either a binary executable, or a script
starting with a line of the form "\fB#! \fIinterpreter \fR[arg]". starting with a line of the form:
.in +0.5i
.nf
\fB#! \fIinterpreter \fR[arg]
.fi
.in
In the latter case, the interpreter must be a valid pathname for an In the latter case, the interpreter must be a valid pathname for an
executable which is not itself a script, which will be invoked as executable which is not itself a script, which will be invoked as
\fBinterpreter\fR [arg] \fIfilename\fR. \fBinterpreter\fR [arg] \fIfilename\fR.
@ -54,8 +61,13 @@ executable which is not itself a script, which will be invoked as
\fBkey=value\fR, which are passed as environment to the new program. \fBkey=value\fR, 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 The argument vector and environment can be accessed by the
called program's main function, when it is defined as \fBint main(int called program's main function, when it is defined as:
argc, char *argv[], char *envp[])\fR.
.in +0.5i
.nf
int main(int argc, char *argv[], char *envp[])\fR.
.fi
.in
\fBexecve\fP() does not return on success, and the text, data, bss, and \fBexecve\fP() does not return on success, and the text, data, bss, and
stack of the calling process are overwritten by that of the program stack of the calling process are overwritten by that of the program