faccessat - 文件相对于一个目录文件描述符的更改权限
内容简介
#include<unistd.h> int faccessat(int dirfd, const char *path, int mode ", int " flags )
描述
The%uA0faccessat() system call operates in exactly the same way as%uA0access(2), except for the differences described in this manual page.
If the pathname given in%uA0path%uA0is relative, then it is interpreted relative to the directory referred to by the file descriptor%uA0dirfd%uA0(rather than relative to the current working directory of the calling process, as is done by%uA0access(2) for a relative pathname).
If the pathname given in%uA0path%uA0is relative and%uA0dirfd%uA0is the special value%uA0AT_FDCWD, thenpath%uA0is interpreted relative to the current working directory of the calling process (likeaccess(2)).
If the pathname given in%uA0path%uA0is absolute, then%uA0dirfd%uA0is ignored.
flags%uA0is constructed by ORing together zero or more of the following values:
Code | 描述 |
---|---|
AT_EACCESS | |
%uA0 | Perform access checks using the effective user and group IDs. By default,%uA0faccessat() uses the effective IDs (like%uA0access(2)). |
AT_SYMLINK_NOFOLLOW | |
%uA0 | If%uA0path%uA0is a symbolic link, do not dereference it: instead return information about the link itself. |
返回值
On success,%uA0faccessat() returns 0. On error, -1 is returned and%uA0errno%uA0is set to indicate the error.
错误
The same errors that occur for%uA0access(2) can also occur for%uA0faccessat(). The following additional errors can occur for%uA0faccessat():
标签 | 描述 |
---|---|
EBADF | dirfd%uA0is not a valid file descriptor. |
EINVAL | Invalid flag specified in%uA0flags. |
ENOTDIR | path%uA0is a relative path and%uA0dirfd%uA0is a file descriptor referring to a file other than a directory. |
注意
See%uA0openat(2) for an explanation of the need for%uA0faccessat().
遵循于
这个系统调用是非标准的,但建议列入POSIX.1将来的修订版。glibc的注意事项
The%uA0AT_EACCESS%uA0and%uA0AT_SYMLINK_NOFOLLOW%uA0flags are actually implemented within the glibc wrapper function for%uA0faccessat(). If either of these flags are specified, then the wrapper function employs%uA0fstatat(2) to determine access permissions.
版本
faccessat() 加入到Linux 的%uA0kernel 2.6.16.