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:
19 _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
20 Before glibc 2.10:
21 _ATFILE_SOURCE
22
24 The fchmodat() system call operates in exactly the same way as
25 chmod(2), except for the differences described in this manual page.
26
27 If the pathname given in pathname is relative, then it is interpreted
28 relative to the directory referred to by the file descriptor dirfd
29 (rather than relative to the current working directory of the calling
30 process, as is done by chmod(2) for a relative pathname).
31
32 If pathname is relative and dirfd is the special value AT_FDCWD, then
33 pathname is interpreted relative to the current working directory of
34 the calling process (like chmod(2)).
35
36 If pathname is absolute, then dirfd is ignored.
37
38 flags can either be 0, or include the following flag:
39
40 AT_SYMLINK_NOFOLLOW
41 If pathname is a symbolic link, do not dereference it: instead
42 operate on the link itself. This flag is not currently impleā
43 mented.
44
46 On success, fchmodat() returns 0. On error, -1 is returned and errno
47 is set to indicate the error.
48
50 The same errors that occur for chmod(2) can also occur for fchmodat().
51 The following additional errors can occur for fchmodat():
52
53 EBADF dirfd is not a valid file descriptor.
54
55 EINVAL Invalid flag specified in flags.
56
57 ENOTDIR
58 pathname is relative and dirfd is a file descriptor referring to
59 a file other than a directory.
60
61 ENOTSUP
62 flags specified AT_SYMLINK_NOFOLLOW, which is not supported.
63
65 fchmodat() was added to Linux in kernel 2.6.16; library support was
66 added to glibc in version 2.4.
67
69 POSIX.1-2008.
70
72 See openat(2) for an explanation of the need for fchmodat().
73
74 The GNU C library wrapper function implements the POSIX-specified
75 interface described in this page. This interface differs from the
76 underlying Linux system call, which does not have a flags argument.
77
79 chmod(2), openat(2), path_resolution(7), symlink(7)
80
82 This page is part of release 3.53 of the Linux man-pages project. A
83 description of the project, and information about reporting bugs, can
84 be found at http://www.kernel.org/doc/man-pages/.
85
86
87
88Linux 2012-05-22 FCHMODAT(2)