1FACCESSAT(2) Linux Programmer's Manual FACCESSAT(2)
2
3
4
6 faccessat - check user's permissions of a file relative to a directory
7 file descriptor
8
10 #define _ATFILE_SOURCE
11 #include <fcntl.h> /* Definition of AT_* constants */
12 #include <unistd.h>
13
14 int faccessat(int dirfd, const char *pathname, int mode, int flags);
15
17 The faccessat() system call operates in exactly the same way as
18 access(2), except for the differences described in this manual page.
19
20 If the pathname given in pathname is relative, then it is interpreted
21 relative to the directory referred to by the file descriptor dirfd
22 (rather than relative to the current working directory of the calling
23 process, as is done by access(2) for a relative pathname).
24
25 If pathname is relative and dirfd is the special value AT_FDCWD, then
26 pathname is interpreted relative to the current working directory of
27 the calling process (like access(2)).
28
29 If pathname is absolute, then dirfd is ignored.
30
31 flags is constructed by ORing together zero or more of the following
32 values:
33
34 AT_EACCESS
35 Perform access checks using the effective user and group IDs.
36 By default, faccessat() uses the real IDs (like access(2)).
37
38 AT_SYMLINK_NOFOLLOW
39 If pathname is a symbolic link, do not dereference it: instead
40 return information about the link itself.
41
43 On success, (all requested permissions granted) faccessat() returns 0.
44 On error, -1 is returned and errno is set to indicate the error.
45
47 The same errors that occur for access(2) can also occur for facces‐
48 sat(). The following additional errors can occur for faccessat():
49
50 EBADF dirfd is not a valid file descriptor.
51
52 EINVAL Invalid flag specified in flags.
53
54 ENOTDIR
55 pathname is relative and dirfd is a file descriptor referring to
56 a file other than a directory.
57
59 faccessat() was added to Linux in kernel 2.6.16.
60
62 POSIX.1-2008.
63
65 See openat(2) for an explanation of the need for faccessat().
66
67 Glibc Notes
68 The AT_EACCESS and AT_SYMLINK_NOFOLLOW flags are actually implemented
69 within the glibc wrapper function for faccessat(). If either of these
70 flags are specified, then the wrapper function employs fstatat(2) to
71 determine access permissions.
72
74 access(2), openat(2), euidaccess(3), credentials(7), path_resolu‐
75 tion(7), symlink(7)
76
78 This page is part of release 3.22 of the Linux man-pages project. A
79 description of the project, and information about reporting bugs, can
80 be found at http://www.kernel.org/doc/man-pages/.
81
82
83
84Linux 2008-08-21 FACCESSAT(2)