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 #define _ATFILE_SOURCE
11 #include <fcntl.h> /* Definition of AT_* constants */
12 #include <unistd.h>
13
14 int fchownat(int dirfd, const char *pathname,
15 uid_t owner, gid_t group, int flags);
16
18 The fchownat() system call operates in exactly the same way as
19 chown(2), except for the differences described in this manual page.
20
21 If the pathname given in pathname is relative, then it is interpreted
22 relative to the directory referred to by the file descriptor dirfd
23 (rather than relative to the current working directory of the calling
24 process, as is done by chown(2) for a relative pathname).
25
26 If pathname is relative and dirfd is the special value AT_FDCWD, then
27 pathname is interpreted relative to the current working directory of
28 the calling process (like chown(2)).
29
30 If pathname is absolute, then dirfd is ignored.
31
32 flags can either be 0, or include the following flag:
33
34 AT_SYMLINK_NOFOLLOW
35 If pathname is a symbolic link, do not dereference it: instead
36 operate on the link itself, like lchown(2). (By default, fchow‐
37 nat() dereferences symbolic links, like chown(2).)
38
40 On success, fchownat() returns 0. On error, -1 is returned and errno
41 is set to indicate the error.
42
44 The same errors that occur for chown(2) can also occur for fchownat().
45 The following additional errors can occur for fchownat():
46
47 EBADF dirfd is not a valid file descriptor.
48
49 EINVAL Invalid flag specified in flags.
50
51 ENOTDIR
52 pathname is relative and dirfd is a file descriptor referring to
53 a file other than a directory.
54
56 fchownat() was added to Linux in kernel 2.6.16.
57
59 POSIX.1-2008. A similar system call exists on Solaris.
60
62 See openat(2) for an explanation of the need for fchownat().
63
65 chown(2), openat(2), path_resolution(7), symlink(7)
66
68 This page is part of release 3.22 of the Linux man-pages project. A
69 description of the project, and information about reporting bugs, can
70 be found at http://www.kernel.org/doc/man-pages/.
71
72
73
74Linux 2008-08-21 FCHOWNAT(2)