]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/faccessat.2
140710546c778ca6ecafa24dd15dc23d35b24e83
[thirdparty/man-pages.git] / man2 / faccessat.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" This manpage is Copyright (C) 2006, Michael Kerrisk
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\"
26 .TH FACCESSAT 2 2007-02-28 "Linux 2.6.16" "Linux Programmer's Manual"
27 .SH NAME
28 faccessat \- check user's permissions of a file relative to a \
29 directory file descriptor
30 .SH SYNOPSIS
31 .nf
32 .B #define _ATFILE_SOURCE
33 .B #include <fcntl.h>
34 .B #include <unistd.h>
35 .sp
36 .BI "int faccessat(int " dirfd ", const char *" pathname ", int " \
37 mode ", int " flags );
38 .fi
39 .SH DESCRIPTION
40 The
41 .BR faccessat ()
42 system call operates in exactly the same way as
43 .BR access (2),
44 except for the differences described in this manual page.
45
46 If the pathname given in
47 .I pathname
48 is relative, then it is interpreted relative to the directory
49 referred to by the file descriptor
50 .IR dirfd
51 (rather than relative to the current working directory of
52 the calling process, as is done by
53 .BR access (2)
54 for a relative pathname).
55
56 If
57 .I pathname
58 is relative and
59 .I dirfd
60 is the special value
61 .BR AT_FDCWD ,
62 then
63 .I pathname
64 is interpreted relative to the current working
65 directory of the calling process (like
66 .BR access (2)).
67
68 If
69 .IR pathname
70 is absolute, then
71 .I dirfd
72 is ignored.
73
74 .I flags
75 is constructed by ORing together zero or more of the following values:
76 .TP
77 .B AT_EACCESS
78 Perform access checks using the effective user and group IDs.
79 By default,
80 .BR faccessat ()
81 uses the real IDs (like
82 .BR access (2)).
83 .TP
84 .B AT_SYMLINK_NOFOLLOW
85 If
86 .I pathname
87 is a symbolic link, do not dereference it:
88 instead return information about the link itself.
89 .SH "RETURN VALUE"
90 On success, (all requested permissions granted)
91 .BR faccessat ()
92 returns 0.
93 On error, \-1 is returned and
94 .I errno
95 is set to indicate the error.
96 .SH ERRORS
97 The same errors that occur for
98 .BR access (2)
99 can also occur for
100 .BR faccessat ().
101 The following additional errors can occur for
102 .BR faccessat ():
103 .TP
104 .B EBADF
105 .I dirfd
106 is not a valid file descriptor.
107 .TP
108 .B EINVAL
109 Invalid flag specified in
110 .IR flags .
111 .TP
112 .B ENOTDIR
113 .I pathname
114 is relative and
115 .I dirfd
116 is a file descriptor referring to a file other than a directory.
117 .SH NOTES
118 See
119 .BR openat (2)
120 for an explanation of the need for
121 .BR faccessat ().
122 .SS Glibc Notes
123 The
124 .B AT_EACCESS
125 and
126 .B AT_SYMLINK_NOFOLLOW
127 flags are actually implemented within the glibc wrapper function for
128 .BR faccessat ().
129 If either of these flags are specified, then the wrapper function employs
130 .BR fstatat (2)
131 to determine access permissions.
132 .SH VERSIONS
133 .BR faccessat ()
134 was added to Linux in kernel 2.6.16.
135 .SH "CONFORMING TO"
136 This system call is non-standard but is proposed
137 for inclusion in a future revision of POSIX.1.
138 .SH "SEE ALSO"
139 .BR access (2),
140 .BR openat (2),
141 .BR path_resolution (2),
142 .BR eauidaccess (3)