1FCHMODAT(2) Linux Programmer's Manual FCHMODAT(2)
2
3
4
6 fchmodat - change permissions of a file relative to a directory file
7 descriptor
8
10 #include <fcntl.h> /* Definition of AT_* constants */
11 #include <sys/stat.h>
12
13 int fchmodat(int dirfd, const char *pathname, mode_t mode, int flags);
14
15 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
16
17 fchmodat():
18 Since glibc 2.10: _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
19 Before glibc 2.10: _ATFILE_SOURCE
20
22 The fchmodat() system call operates in exactly the same way as
23 chmod(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 chmod(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 chmod(2)).
33
34 If pathname is absolute, then dirfd is ignored.
35
36 flags can either be 0, or include the following flag:
37
38 AT_SYMLINK_NOFOLLOW
39 If pathname is a symbolic link, do not dereference it: instead
40 operate on the link itself. This flag is not currently impleā
41 mented.
42
44 On success, fchmodat() returns 0. On error, -1 is returned and errno
45 is set to indicate the error.
46
48 The same errors that occur for chmod(2) can also occur for fchmodat().
49 The following additional errors can occur for fchmodat():
50
51 EBADF dirfd is not a valid file descriptor.
52
53 EINVAL Invalid flag specified in flags.
54
55 ENOTDIR
56 pathname is relative and dirfd is a file descriptor referring to
57 a file other than a directory.
58
59 ENOTSUP
60 flags specified AT_SYMLINK_NOFOLLOW, which is not supported.
61
63 fchmodat() was added to Linux in kernel 2.6.16.
64
66 POSIX.1-2008.
67
69 See openat(2) for an explanation of the need for fchmodat().
70
72 chmod(2), openat(2), path_resolution(7), symlink(7)
73
75 This page is part of release 3.25 of the Linux man-pages project. A
76 description of the project, and information about reporting bugs, can
77 be found at http://www.kernel.org/doc/man-pages/.
78
79
80
81Linux 2009-12-13 FCHMODAT(2)