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 #include <fcntl.h> /* Definition of AT_* constants */
11 #include <unistd.h>
12
13 int faccessat(int dirfd, const char *pathname, int mode, int flags);
14
15 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
16
17 faccessat():
18 Since glibc 2.10:
19 _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
20 Before glibc 2.10:
21 _ATFILE_SOURCE
22
24 The faccessat() system call operates in exactly the same way as
25 access(2), except for the differences described in this manual page.
26
27 If the pathname given in pathname is relative, then it is interpreted
28 relative to the directory referred to by the file descriptor dirfd
29 (rather than relative to the current working directory of the calling
30 process, as is done by access(2) for a relative pathname).
31
32 If pathname is relative and dirfd is the special value AT_FDCWD, then
33 pathname is interpreted relative to the current working directory of
34 the calling process (like access(2)).
35
36 If pathname is absolute, then dirfd is ignored.
37
38 flags is constructed by ORing together zero or more of the following
39 values:
40
41 AT_EACCESS
42 Perform access checks using the effective user and group IDs.
43 By default, faccessat() uses the real IDs (like access(2)).
44
45 AT_SYMLINK_NOFOLLOW
46 If pathname is a symbolic link, do not dereference it: instead
47 return information about the link itself.
48
50 On success, (all requested permissions granted) faccessat() returns 0.
51 On error, -1 is returned and errno is set to indicate the error.
52
54 The same errors that occur for access(2) can also occur for facces‐
55 sat(). The following additional errors can occur for faccessat():
56
57 EBADF dirfd is not a valid file descriptor.
58
59 EINVAL Invalid flag specified in flags.
60
61 ENOTDIR
62 pathname is relative and dirfd is a file descriptor referring to
63 a file other than a directory.
64
66 faccessat() was added to Linux in kernel 2.6.16; library support was
67 added to glibc in version 2.4.
68
70 POSIX.1-2008.
71
73 See openat(2) for an explanation of the need for faccessat().
74
75 Warning: faccessat() is subject to the same kinds of races as access(2)
76 and euidaccess(3).
77
78 Glibc notes
79 The AT_EACCESS and AT_SYMLINK_NOFOLLOW flags are actually implemented
80 within the glibc wrapper function for faccessat(). If either of these
81 flags are specified, then the wrapper function employs fstatat(2) to
82 determine access permissions.
83
85 access(2), openat(2), euidaccess(3), credentials(7), path_resolu‐
86 tion(7), symlink(7)
87
89 This page is part of release 3.53 of the Linux man-pages project. A
90 description of the project, and information about reporting bugs, can
91 be found at http://www.kernel.org/doc/man-pages/.
92
93
94
95Linux 2012-05-04 FACCESSAT(2)