]>
Commit | Line | Data |
---|---|---|
a53b8cb2 MK |
1 | .\" This manpage is Copyright (C) 2006, Michael Kerrisk |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
a53b8cb2 MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
c13182ef | 12 | .\" |
a53b8cb2 MK |
13 | .\" Since the Linux kernel and libraries are constantly changing, this |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
a53b8cb2 MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
a53b8cb2 | 24 | .\" |
c95b6ae1 | 25 | .TH FCHMODAT 2 2012-05-22 "Linux" "Linux Programmer's Manual" |
a53b8cb2 MK |
26 | .SH NAME |
27 | fchmodat \- change permissions of a file relative to a directory \ | |
28 | file descriptor | |
29 | .SH SYNOPSIS | |
30 | .nf | |
244195af | 31 | .BR "#include <fcntl.h>" " /* Definition of AT_* constants */" |
a53b8cb2 MK |
32 | .B #include <sys/stat.h> |
33 | .sp | |
1343b604 | 34 | .BI "int fchmodat(int " dirfd ", const char *" pathname ", mode_t " \ |
a53b8cb2 MK |
35 | mode ", int " flags ); |
36 | .fi | |
7cc796ee MK |
37 | .sp |
38 | .in -4n | |
39 | Feature Test Macro Requirements for glibc (see | |
40 | .BR feature_test_macros (7)): | |
41 | .in | |
42 | .sp | |
43 | .BR fchmodat (): | |
cebcc73f MK |
44 | .PD 0 |
45 | .ad l | |
46 | .RS 4 | |
47 | .TP 4 | |
48 | Since glibc 2.10: | |
49 | _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L | |
50 | .TP | |
7cc796ee MK |
51 | Before glibc 2.10: |
52 | _ATFILE_SOURCE | |
cebcc73f MK |
53 | .RE |
54 | .ad | |
55 | .PD | |
a53b8cb2 MK |
56 | .SH DESCRIPTION |
57 | The | |
58 | .BR fchmodat () | |
59 | system call operates in exactly the same way as | |
60 | .BR chmod (2), | |
61 | except for the differences described in this manual page. | |
62 | ||
c13182ef | 63 | If the pathname given in |
1343b604 | 64 | .I pathname |
a53b8cb2 MK |
65 | is relative, then it is interpreted relative to the directory |
66 | referred to by the file descriptor | |
0daa9e92 | 67 | .I dirfd |
c13182ef | 68 | (rather than relative to the current working directory of |
a53b8cb2 MK |
69 | the calling process, as is done by |
70 | .BR chmod (2) | |
71 | for a relative pathname). | |
72 | ||
c13182ef | 73 | If |
1343b604 | 74 | .I pathname |
c13182ef | 75 | is relative and |
a53b8cb2 MK |
76 | .I dirfd |
77 | is the special value | |
78 | .BR AT_FDCWD , | |
79 | then | |
1343b604 | 80 | .I pathname |
c13182ef | 81 | is interpreted relative to the current working |
a53b8cb2 MK |
82 | directory of the calling process (like |
83 | .BR chmod (2)). | |
84 | ||
c13182ef | 85 | If |
0daa9e92 | 86 | .I pathname |
c13182ef MK |
87 | is absolute, then |
88 | .I dirfd | |
a53b8cb2 MK |
89 | is ignored. |
90 | ||
91 | .I flags | |
92 | can either be 0, or include the following flag: | |
93 | .TP | |
94 | .B AT_SYMLINK_NOFOLLOW | |
c13182ef | 95 | If |
1343b604 | 96 | .I pathname |
c13182ef | 97 | is a symbolic link, do not dereference it: |
4f518005 | 98 | instead operate on the link itself. |
a53b8cb2 | 99 | This flag is not currently implemented. |
47297adb | 100 | .SH RETURN VALUE |
a53b8cb2 | 101 | On success, |
c13182ef MK |
102 | .BR fchmodat () |
103 | returns 0. | |
a53b8cb2 MK |
104 | On error, \-1 is returned and |
105 | .I errno | |
106 | is set to indicate the error. | |
107 | .SH ERRORS | |
108 | The same errors that occur for | |
109 | .BR chmod (2) | |
110 | can also occur for | |
111 | .BR fchmodat (). | |
c13182ef | 112 | The following additional errors can occur for |
a53b8cb2 MK |
113 | .BR fchmodat (): |
114 | .TP | |
115 | .B EBADF | |
116 | .I dirfd | |
117 | is not a valid file descriptor. | |
118 | .TP | |
119 | .B EINVAL | |
120 | Invalid flag specified in | |
121 | .IR flags . | |
122 | .TP | |
123 | .B ENOTDIR | |
1343b604 | 124 | .I pathname |
b328773d | 125 | is relative and |
a53b8cb2 MK |
126 | .I dirfd |
127 | is a file descriptor referring to a file other than a directory. | |
128 | .TP | |
129 | .B ENOTSUP | |
0daa9e92 | 130 | .I flags |
a53b8cb2 MK |
131 | specified |
132 | .BR AT_SYMLINK_NOFOLLOW , | |
133 | which is not supported. | |
a1d5f77c MK |
134 | .SH VERSIONS |
135 | .BR fchmodat () | |
c95b6ae1 MK |
136 | was added to Linux in kernel 2.6.16; |
137 | library support was added to glibc in version 2.4. | |
47297adb | 138 | .SH CONFORMING TO |
5144e45f | 139 | POSIX.1-2008. |
a53b8cb2 MK |
140 | .SH NOTES |
141 | See | |
142 | .BR openat (2) | |
143 | for an explanation of the need for | |
0364dd73 | 144 | .BR fchmodat (). |
2d350ede | 145 | |
a146d9cc MK |
146 | The GNU C library wrapper function implements the POSIX-specified |
147 | interface described in this page. | |
148 | This interface differs from the underlying Linux system call, which does | |
2d350ede MK |
149 | .I not |
150 | have a | |
151 | .I flags | |
152 | argument. | |
47297adb | 153 | .SH SEE ALSO |
a53b8cb2 MK |
154 | .BR chmod (2), |
155 | .BR openat (2), | |