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 <sys/stat.h>
12
13 int fchmodat(int dirfd, const char *pathname, mode_t mode, int flags);
14
16 The fchmodat() system call operates in exactly the same way as
17 chmod(2), except for the differences described in this manual page.
18
19 If the pathname given in pathname is relative, then it is interpreted
20 relative to the directory referred to by the file descriptor dirfd
21 (rather than relative to the current working directory of the calling
22 process, as is done by chmod(2) for a relative pathname).
23
24 If pathname is relative and dirfd is the special value AT_FDCWD, then
25 pathname is interpreted relative to the current working directory of
26 the calling process (like chmod(2)).
27
28 If pathname is absolute, then dirfd is ignored.
29
30 flags can either be 0, or include the following flag:
31
32 AT_SYMLINK_NOFOLLOW
33 If pathname is a symbolic link, do not dereference it: instead
34 operate on the link itself. This flag is not currently impleā
35 mented.
36
38 On success, fchmodat() returns 0. On error, -1 is returned and errno
39 is set to indicate the error.
40
42 The same errors that occur for chmod(2) can also occur for fchmodat().
43 The following additional errors can occur for fchmodat():
44
45 EBADF dirfd is not a valid file descriptor.
46
47 EINVAL Invalid flag specified in flags.
48
49 ENOTDIR
50 pathname is relative and dirfd is a file descriptor referring to
51 a file other than a directory.
52
53 ENOTSUP
54 flags specified AT_SYMLINK_NOFOLLOW, which is not supported.
55
57 See openat(2) for an explanation of the need for fchmodat().
58
60 This system call is non-standard but is proposed for inclusion in a
61 future revision of POSIX.1.
62
64 fchmodat() was added to Linux in kernel 2.6.16.
65
67 chmod(2), openat(2), path_resolution(2)
68
69
70
71Linux 2.6.16 2006-05-05 FCHMODAT(2)