diff --git a/man2/execveat.2 b/man2/execveat.2 index 937d79e4c..a018e48e5 100644 --- a/man2/execveat.2 +++ b/man2/execveat.2 @@ -22,24 +22,26 @@ .\" the source, must acknowledge the copyright and authors of this work. .\" %%%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 execveat \- execute program relative to a directory file descriptor .SH SYNOPSIS .B #include .sp -.BI "int execveat(int " fd ", const char *" pathname "," +.BI "int execveat(int " dirfd ", const char *" pathname "," .br -.BI " char *const " argv "[], char *const " envp "[]," +.BI " char *const " argv "[], char *const " envp "[]," .br -.BI " int " flags); +.BI " int " flags ); .SH DESCRIPTION +.\" commit 51f39a1f0cea1cacf8c787f652f26dfee9611874 The .BR execveat () -system call executes the program pointed to by the combination of \fIfd\fP and \fIpathname\fP. -The -.BR execveat () -system call operates in exactly the same way as +system call executes the program referred to by the combination of +.I dirfd +and +.IR pathname . +It operates in exactly the same way as .BR execve (2), except for the differences described in this manual page. @@ -47,7 +49,7 @@ If the pathname given in .I pathname is relative, then it is interpreted relative to the directory referred to by the file descriptor -.I fd +.I dirfd (rather than relative to the current working directory of the calling process, as is done by .BR execve (2) @@ -56,7 +58,7 @@ for a relative pathname). If .I pathname is relative and -.I fd +.I dirfd is the special value .BR AT_FDCWD , then @@ -68,7 +70,7 @@ directory of the calling process (like If .I pathname is absolute, then -.I fd +.I dirfd is ignored. If @@ -76,17 +78,20 @@ If is an empty string and the .BR AT_EMPTY_PATH flag is specified, then the file descriptor -.I fd -specifies the file to be executed. +.I dirfd +specifies the file to be executed (i.e., +.IR dirfd +refers to an executable file, rather than a directory). +The .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 .BR AT_EMPTY_PATH If .I pathname is an empty string, operate on the file referred to by -.IR fd +.IR dirfd (which may have been obtained using the .BR open (2) .B O_PATH @@ -94,7 +99,7 @@ flag). .TP .B AT_SYMLINK_NOFOLLOW If the file identified by -.I fd +.I dirfd and a non-NULL .I pathname 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" On success, .BR execveat () -does not return. On error \-1 is returned, and +does not return. +On error, \-1 is returned, and .I errno is set appropriately. .SH ERRORS @@ -114,30 +120,34 @@ The following additional errors can occur for .BR execveat (): .TP .B EBADF -.I fd +.I dirfd is not a valid file descriptor. .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 Invalid flag specified in .IR flags . .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 .I pathname is relative and -.I fd +.I dirfd is a file descriptor referring to a file other than a directory. .SH VERSIONS .BR execveat () -was added to Linux in kernel 3.???. +was added to Linux in kernel 3.19. .SH NOTES In addition to the reasons explained in .BR openat (2), @@ -150,4 +160,5 @@ to be implemented on systems that do not have the filesystem mounted. .SH SEE ALSO .BR execve (2), +.BR openat (2), .BR fexecve (3)