execveat.2: Light edits to new page

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2015-01-09 15:11:42 +01:00
parent 9dabaedf87
commit 2dd8ff89ef
1 changed files with 40 additions and 29 deletions

View File

@ -22,24 +22,26 @@
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END .\" %%%LICENSE_END
.\" .\"
.TH EXECVEAT 2 2014-04-02 "Linux" "Linux Programmer's Manual" .TH EXECVEAT 2 2015-01-09 "Linux" "Linux Programmer's Manual"
.SH NAME .SH NAME
execveat \- execute program relative to a directory file descriptor execveat \- execute program relative to a directory file descriptor
.SH SYNOPSIS .SH SYNOPSIS
.B #include <unistd.h> .B #include <unistd.h>
.sp .sp
.BI "int execveat(int " fd ", const char *" pathname "," .BI "int execveat(int " dirfd ", const char *" pathname ","
.br .br
.BI " char *const " argv "[], char *const " envp "[]," .BI " char *const " argv "[], char *const " envp "[],"
.br .br
.BI " int " flags); .BI " int " flags );
.SH DESCRIPTION .SH DESCRIPTION
.\" commit 51f39a1f0cea1cacf8c787f652f26dfee9611874
The The
.BR execveat () .BR execveat ()
system call executes the program pointed to by the combination of \fIfd\fP and \fIpathname\fP. system call executes the program referred to by the combination of
The .I dirfd
.BR execveat () and
system call operates in exactly the same way as .IR pathname .
It operates in exactly the same way as
.BR execve (2), .BR execve (2),
except for the differences described in this manual page. except for the differences described in this manual page.
@ -47,7 +49,7 @@ If the pathname given in
.I pathname .I pathname
is relative, then it is interpreted relative to the directory is relative, then it is interpreted relative to the directory
referred to by the file descriptor referred to by the file descriptor
.I fd .I dirfd
(rather than relative to the current working directory of (rather than relative to the current working directory of
the calling process, as is done by the calling process, as is done by
.BR execve (2) .BR execve (2)
@ -56,7 +58,7 @@ for a relative pathname).
If If
.I pathname .I pathname
is relative and is relative and
.I fd .I dirfd
is the special value is the special value
.BR AT_FDCWD , .BR AT_FDCWD ,
then then
@ -68,7 +70,7 @@ directory of the calling process (like
If If
.I pathname .I pathname
is absolute, then is absolute, then
.I fd .I dirfd
is ignored. is ignored.
If If
@ -76,17 +78,20 @@ If
is an empty string and the is an empty string and the
.BR AT_EMPTY_PATH .BR AT_EMPTY_PATH
flag is specified, then the file descriptor flag is specified, then the file descriptor
.I fd .I dirfd
specifies the file to be executed. specifies the file to be executed (i.e.,
.IR dirfd
refers to an executable file, rather than a directory).
The
.I flags .I flags
can either be 0, or include the following flags: argument is a bit mask that can include zero or more of the following flags:
.TP .TP
.BR AT_EMPTY_PATH .BR AT_EMPTY_PATH
If If
.I pathname .I pathname
is an empty string, operate on the file referred to by is an empty string, operate on the file referred to by
.IR fd .IR dirfd
(which may have been obtained using the (which may have been obtained using the
.BR open (2) .BR open (2)
.B O_PATH .B O_PATH
@ -94,7 +99,7 @@ flag).
.TP .TP
.B AT_SYMLINK_NOFOLLOW .B AT_SYMLINK_NOFOLLOW
If the file identified by If the file identified by
.I fd .I dirfd
and a non-NULL and a non-NULL
.I pathname .I pathname
is a symbolic link, then the call fails with the error is a symbolic link, then the call fails with the error
@ -102,7 +107,8 @@ is a symbolic link, then the call fails with the error
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, On success,
.BR execveat () .BR execveat ()
does not return. On error \-1 is returned, and does not return.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -114,30 +120,34 @@ The following additional errors can occur for
.BR execveat (): .BR execveat ():
.TP .TP
.B EBADF .B EBADF
.I fd .I dirfd
is not a valid file descriptor. is not a valid file descriptor.
.TP .TP
.B ENOENT
The program identified by \fIfd\fP and \fIpathname\fP requires the
use of an interpreter program (such as a script starting with
"#!") but the file descriptor
.I fd
was opened with the
.B O_CLOEXEC
flag and so the program file is inaccessible to the launched interpreter.
.TP
.B EINVAL .B EINVAL
Invalid flag specified in Invalid flag specified in
.IR flags . .IR flags .
.TP .TP
.B ENOENT
The program identified by
.I dirfd
and
.I pathname
requires the use of an interpreter program
(such as a script starting with "#!"), but the file descriptor
.I dirfd
was opened with the
.B O_CLOEXEC
flag, with the result that
the program file is inaccessible to the launched interpreter.
.TP
.B ENOTDIR .B ENOTDIR
.I pathname .I pathname
is relative and is relative and
.I fd .I dirfd
is a file descriptor referring to a file other than a directory. is a file descriptor referring to a file other than a directory.
.SH VERSIONS .SH VERSIONS
.BR execveat () .BR execveat ()
was added to Linux in kernel 3.???. was added to Linux in kernel 3.19.
.SH NOTES .SH NOTES
In addition to the reasons explained in In addition to the reasons explained in
.BR openat (2), .BR openat (2),
@ -150,4 +160,5 @@ to be implemented on systems that do not have the
filesystem mounted. filesystem mounted.
.SH SEE ALSO .SH SEE ALSO
.BR execve (2), .BR execve (2),
.BR openat (2),
.BR fexecve (3) .BR fexecve (3)