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 <unistd.h>
12
13 int fchownat(int dirfd, const char *pathname,
14 uid_t owner, gid_t group, int flags);
15
17 The fchownat() system call operates in exactly the same way as
18 chown(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 chown(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 chown(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, like lchown(2). (By default, fchow‐
36 nat() dereferences symbolic links, like chown(2).)
37
39 On success, fchownat() returns 0. On error, -1 is returned and errno
40 is set to indicate the error.
41
43 The same errors that occur for chown(2) can also occur for fchownat().
44 The following additional errors can occur for fchownat():
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
55 See openat(2) for an explanation of the need for fchownat().
56
58 This system call is non-standard but is proposed for inclusion in a
59 future revision of POSIX.1. A similar system call exists on Solaris.
60
62 fchownat() was added to Linux in kernel 2.6.16.
63
65 chown(2), openat(2), path_resolution(2)
66
67
68
69Linux 2.6.16 2006-05-05 FCHOWNAT(2)