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 #define _ATFILE_SOURCE
11 #include <fcntl.h> /* Definition of AT_* constants */
12 #include <sys/stat.h>
13
14 int fchmodat(int dirfd, const char *pathname, mode_t mode, int flags);
15
17 The fchmodat() system call operates in exactly the same way as
18 chmod(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 chmod(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 chmod(2)).
28
29 If pathname is absolute, then dirfd is ignored.
30
31 flags can either be 0, or include the following flag:
32
33 AT_SYMLINK_NOFOLLOW
34 If pathname is a symbolic link, do not dereference it: instead
35 operate on the link itself. This flag is not currently impleā
36 mented.
37
39 On success, fchmodat() returns 0. On error, -1 is returned and errno
40 is set to indicate the error.
41
43 The same errors that occur for chmod(2) can also occur for fchmodat().
44 The following additional errors can occur for fchmodat():
45
46 EBADF dirfd is not a valid file descriptor.
47
48 EINVAL Invalid flag specified in flags.
49
50 ENOTDIR
51 pathname is relative and dirfd is a file descriptor referring to
52 a file other than a directory.
53
54 ENOTSUP
55 flags specified AT_SYMLINK_NOFOLLOW, which is not supported.
56
58 fchmodat() was added to Linux in kernel 2.6.16.
59
61 POSIX.1-2008.
62
64 See openat(2) for an explanation of the need for fchmodat().
65
67 chmod(2), openat(2), path_resolution(7), symlink(7)
68
70 This page is part of release 3.22 of the Linux man-pages project. A
71 description of the project, and information about reporting bugs, can
72 be found at http://www.kernel.org/doc/man-pages/.
73
74
75
76Linux 2008-08-21 FCHMODAT(2)