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>
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 See openat(2) for an explanation of the need for faccessat().
60
62 This system call is non-standard but is proposed for inclusion in a
63 future revision of POSIX.1.
64
66 The AT_EACCESS and AT_SYMLINK_NOFOLLOW flags are actually implemented
67 within the glibc wrapper function for faccessat(). If either of these
68 flags are specified, then the wrapper function employs fstatat(2) to
69 determine access permissions.
70
72 faccessat() was added to Linux in kernel 2.6.16.
73
75 access(2), openat(2), path_resolution(2)
76
77
78
79Linux 2.6.16 2007-02-28 FACCESSAT(2)