sys_faccessat  [fs/open.c]


Determines accessibility of a file relative to a directory file descriptor.
This system call operates in exactly the same way as sys_access, except for the differences described in this manual page.

Arguments

eax 307
ebx If the pathname pointed by ecx is relative, then it is interpreted relative to the directory referred to by the file descriptor ebx (rather than relative to the current working directory of the calling process, as is done by sys_access for a relative pathname).
If the pathname pointed by ecx is relative and ebx is the special value AT_FDCWD, then path is interpreted relative to the current working directory of the calling process.
If the pathname pointed by ecx is absolute, then ebx is ignored.
ecx Pointer to a null-terminated string that specifies the name of a file.
edx Mode. It may be one or a result of the bitwise-or operation of a number of the following values:
F_OK - Test for existence.
X_OK - Test for execute permission.
W_OK - Test for write permission.
R_OK - Test for read permission.

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:

-EIO An I/O error occurred while reading from or writing to the file system.
-EACCES Search permission is denied for one of the directories in the path prefix of the path.
-ENOTDIR A component used as a directory in pathname is not, in fact, a directory
-EIO An I/O error occurred while reading from or writing to the file system.
-ELOOP Too many symbolic links were encountered in path resolving.
-ENAMETOOLONG Path is too long.
-ENOMEM Insufficient kernel memory was available.
-ENOENT The file does not exist.
-EINVAL Mode was incorrectly specified.
-EFAULT Path points outside your accessible address space.
-EBADF ebx is not a valid file descriptor.
-ENOTDIR Path pointed by ecx is a relative path and ebx is a file descriptor referring to a file other than a directory.

Remarks

The check is done with the process's real UID and GID, rather than with the effective IDs as is done when actually attempting an operation. This is to allow set-user-ID programs to easily determine the invoking user's authority.

If the process has appropriate privileges, an implementation may indicate success for X_OK even if none of the execute file permission bits are set.

Compatibility

Available since 2.6.16.