1FCHOWNAT(2)                Linux Programmer's Manual               FCHOWNAT(2)
2
3
4

NAME

6       fchownat  -  change  ownership  of  a file relative to a directory file
7       descriptor
8

SYNOPSIS

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:
20               _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
21           Before glibc 2.10:
22               _ATFILE_SOURCE
23

DESCRIPTION

25       The fchownat()  system  call  operates  in  exactly  the  same  way  as
26       chown(2), except for the differences described in this manual page.
27
28       If  the  pathname given in pathname is relative, then it is interpreted
29       relative to the directory referred to  by  the  file  descriptor  dirfd
30       (rather  than  relative to the current working directory of the calling
31       process, as is done by chown(2) for a relative pathname).
32
33       If pathname is relative and dirfd is the special value  AT_FDCWD,  then
34       pathname  is  interpreted  relative to the current working directory of
35       the calling process (like chown(2)).
36
37       If pathname is absolute, then dirfd is ignored.
38
39       The flags argument is a bit mask created by ORing together 0 or more of
40       the following values;
41
42       AT_EMPTY_PATH (since Linux 2.6.39)
43              If  pathname is an empty string, operate on the file referred to
44              by dirfd (which may have been obtained using the open(2)  O_PATH
45              flag).   In  this case, dirfd can refer to any type of file, not
46              just a directory.
47
48
49       AT_SYMLINK_NOFOLLOW
50              If pathname is a symbolic link, do not dereference  it:  instead
51              operate on the link itself, like lchown(2).  (By default, fchow‐
52              nat() dereferences symbolic links, like chown(2).)
53

RETURN VALUE

55       On success, fchownat() returns 0.  On error, -1 is returned  and  errno
56       is set to indicate the error.
57

ERRORS

59       The  same errors that occur for chown(2) can also occur for fchownat().
60       The following additional errors can occur for fchownat():
61
62       EBADF  dirfd is not a valid file descriptor.
63
64       EINVAL Invalid flag specified in flags.
65
66       ENOTDIR
67              pathname is relative and dirfd is a file descriptor referring to
68              a file other than a directory.
69

VERSIONS

71       fchownat()  was  added  to  Linux in kernel 2.6.16; library support was
72       added to glibc in version 2.4.
73

CONFORMING TO

75       POSIX.1-2008.  A similar system call exists on Solaris.
76

NOTES

78       See openat(2) for an explanation of the need for fchownat().
79

SEE ALSO

81       chown(2), openat(2), path_resolution(7), symlink(7)
82

COLOPHON

84       This page is part of release 3.53 of the Linux  man-pages  project.   A
85       description  of  the project, and information about reporting bugs, can
86       be found at http://www.kernel.org/doc/man-pages/.
87
88
89
90Linux                             2013-07-21                       FCHOWNAT(2)
Impressum