1FCHOWNAT(2) Linux Programmer's Manual FCHOWNAT(2)
2
3
4
6 fchownat - change ownership of a file relative to a directory file
7 descriptor
8
10 #include <fcntl.h> /* Definition of AT_* constants */
11 #include <unistd.h>
12
13 int fchownat(int dirfd, const char *pathname,
14 uid_t owner, gid_t group, int flags);
15
16 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
17
18 fchownat():
19 Since glibc 2.10: _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
20 Before glibc 2.10: _ATFILE_SOURCE
21
23 The fchownat() system call operates in exactly the same way as
24 chown(2), except for the differences described in this manual page.
25
26 If the pathname given in pathname is relative, then it is interpreted
27 relative to the directory referred to by the file descriptor dirfd
28 (rather than relative to the current working directory of the calling
29 process, as is done by chown(2) for a relative pathname).
30
31 If pathname is relative and dirfd is the special value AT_FDCWD, then
32 pathname is interpreted relative to the current working directory of
33 the calling process (like chown(2)).
34
35 If pathname is absolute, then dirfd is ignored.
36
37 flags can either be 0, or include the following flag:
38
39 AT_SYMLINK_NOFOLLOW
40 If pathname is a symbolic link, do not dereference it: instead
41 operate on the link itself, like lchown(2). (By default, fchow‐
42 nat() dereferences symbolic links, like chown(2).)
43
45 On success, fchownat() returns 0. On error, -1 is returned and errno
46 is set to indicate the error.
47
49 The same errors that occur for chown(2) can also occur for fchownat().
50 The following additional errors can occur for fchownat():
51
52 EBADF dirfd is not a valid file descriptor.
53
54 EINVAL Invalid flag specified in flags.
55
56 ENOTDIR
57 pathname is relative and dirfd is a file descriptor referring to
58 a file other than a directory.
59
61 fchownat() was added to Linux in kernel 2.6.16.
62
64 POSIX.1-2008. A similar system call exists on Solaris.
65
67 See openat(2) for an explanation of the need for fchownat().
68
70 chown(2), openat(2), path_resolution(7), symlink(7)
71
73 This page is part of release 3.25 of the Linux man-pages project. A
74 description of the project, and information about reporting bugs, can
75 be found at http://www.kernel.org/doc/man-pages/.
76
77
78
79Linux 2009-12-13 FCHOWNAT(2)