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: _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
19 Before glibc 2.10: _ATFILE_SOURCE
20
22 The faccessat() system call operates in exactly the same way as
23 access(2), except for the differences described in this manual page.
24
25 If the pathname given in pathname is relative, then it is interpreted
26 relative to the directory referred to by the file descriptor dirfd
27 (rather than relative to the current working directory of the calling
28 process, as is done by access(2) for a relative pathname).
29
30 If pathname is relative and dirfd is the special value AT_FDCWD, then
31 pathname is interpreted relative to the current working directory of
32 the calling process (like access(2)).
33
34 If pathname is absolute, then dirfd is ignored.
35
36 flags is constructed by ORing together zero or more of the following
37 values:
38
39 AT_EACCESS
40 Perform access checks using the effective user and group IDs.
41 By default, faccessat() uses the real IDs (like access(2)).
42
43 AT_SYMLINK_NOFOLLOW
44 If pathname is a symbolic link, do not dereference it: instead
45 return information about the link itself.
46
48 On success, (all requested permissions granted) faccessat() returns 0.
49 On error, -1 is returned and errno is set to indicate the error.
50
52 The same errors that occur for access(2) can also occur for facces‐
53 sat(). The following additional errors can occur for faccessat():
54
55 EBADF dirfd is not a valid file descriptor.
56
57 EINVAL Invalid flag specified in flags.
58
59 ENOTDIR
60 pathname is relative and dirfd is a file descriptor referring to
61 a file other than a directory.
62
64 faccessat() was added to Linux in kernel 2.6.16.
65
67 POSIX.1-2008.
68
70 See openat(2) for an explanation of the need for faccessat().
71
72 Glibc Notes
73 The AT_EACCESS and AT_SYMLINK_NOFOLLOW flags are actually implemented
74 within the glibc wrapper function for faccessat(). If either of these
75 flags are specified, then the wrapper function employs fstatat(2) to
76 determine access permissions.
77
79 access(2), openat(2), euidaccess(3), credentials(7), path_resolu‐
80 tion(7), symlink(7)
81
83 This page is part of release 3.25 of the Linux man-pages project. A
84 description of the project, and information about reporting bugs, can
85 be found at http://www.kernel.org/doc/man-pages/.
86
87
88
89Linux 2009-12-13 FACCESSAT(2)