]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/fchmodat.2
ldd.1, arch_prctl.2, faccessat.2, fchmodat.2, fchownat.2, flock.2, futimesat.2, getcp...
[thirdparty/man-pages.git] / man2 / fchmodat.2
CommitLineData
a53b8cb2
MK
1.\" This manpage is Copyright (C) 2006, Michael Kerrisk
2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
a53b8cb2
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
c13182ef 12.\"
a53b8cb2
MK
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
c13182ef 20.\"
a53b8cb2
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
a53b8cb2 24.\"
c95b6ae1 25.TH FCHMODAT 2 2012-05-22 "Linux" "Linux Programmer's Manual"
a53b8cb2
MK
26.SH NAME
27fchmodat \- change permissions of a file relative to a directory \
28file descriptor
29.SH SYNOPSIS
30.nf
244195af 31.BR "#include <fcntl.h>" " /* Definition of AT_* constants */"
a53b8cb2
MK
32.B #include <sys/stat.h>
33.sp
1343b604 34.BI "int fchmodat(int " dirfd ", const char *" pathname ", mode_t " \
a53b8cb2
MK
35mode ", int " flags );
36.fi
7cc796ee
MK
37.sp
38.in -4n
39Feature Test Macro Requirements for glibc (see
40.BR feature_test_macros (7)):
41.in
42.sp
43.BR fchmodat ():
cebcc73f
MK
44.PD 0
45.ad l
46.RS 4
47.TP 4
48Since glibc 2.10:
49_XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
50.TP
7cc796ee
MK
51Before glibc 2.10:
52_ATFILE_SOURCE
cebcc73f
MK
53.RE
54.ad
55.PD
a53b8cb2
MK
56.SH DESCRIPTION
57The
58.BR fchmodat ()
59system call operates in exactly the same way as
60.BR chmod (2),
61except for the differences described in this manual page.
62
c13182ef 63If the pathname given in
1343b604 64.I pathname
a53b8cb2
MK
65is relative, then it is interpreted relative to the directory
66referred to by the file descriptor
0daa9e92 67.I dirfd
c13182ef 68(rather than relative to the current working directory of
a53b8cb2
MK
69the calling process, as is done by
70.BR chmod (2)
71for a relative pathname).
72
c13182ef 73If
1343b604 74.I pathname
c13182ef 75is relative and
a53b8cb2
MK
76.I dirfd
77is the special value
78.BR AT_FDCWD ,
79then
1343b604 80.I pathname
c13182ef 81is interpreted relative to the current working
a53b8cb2
MK
82directory of the calling process (like
83.BR chmod (2)).
84
c13182ef 85If
0daa9e92 86.I pathname
c13182ef
MK
87is absolute, then
88.I dirfd
a53b8cb2
MK
89is ignored.
90
91.I flags
92can either be 0, or include the following flag:
93.TP
94.B AT_SYMLINK_NOFOLLOW
c13182ef 95If
1343b604 96.I pathname
c13182ef 97is a symbolic link, do not dereference it:
4f518005 98instead operate on the link itself.
a53b8cb2 99This flag is not currently implemented.
47297adb 100.SH RETURN VALUE
a53b8cb2 101On success,
c13182ef
MK
102.BR fchmodat ()
103returns 0.
a53b8cb2
MK
104On error, \-1 is returned and
105.I errno
106is set to indicate the error.
107.SH ERRORS
108The same errors that occur for
109.BR chmod (2)
110can also occur for
111.BR fchmodat ().
c13182ef 112The following additional errors can occur for
a53b8cb2
MK
113.BR fchmodat ():
114.TP
115.B EBADF
116.I dirfd
117is not a valid file descriptor.
118.TP
119.B EINVAL
120Invalid flag specified in
121.IR flags .
122.TP
123.B ENOTDIR
1343b604 124.I pathname
b328773d 125is relative and
a53b8cb2
MK
126.I dirfd
127is a file descriptor referring to a file other than a directory.
128.TP
129.B ENOTSUP
0daa9e92 130.I flags
a53b8cb2
MK
131specified
132.BR AT_SYMLINK_NOFOLLOW ,
133which is not supported.
a1d5f77c
MK
134.SH VERSIONS
135.BR fchmodat ()
c95b6ae1
MK
136was added to Linux in kernel 2.6.16;
137library support was added to glibc in version 2.4.
47297adb 138.SH CONFORMING TO
5144e45f 139POSIX.1-2008.
a53b8cb2
MK
140.SH NOTES
141See
142.BR openat (2)
143for an explanation of the need for
0364dd73 144.BR fchmodat ().
2d350ede 145
a146d9cc
MK
146The GNU C library wrapper function implements the POSIX-specified
147interface described in this page.
148This interface differs from the underlying Linux system call, which does
2d350ede
MK
149.I not
150have a
151.I flags
152argument.
47297adb 153.SH SEE ALSO
a53b8cb2
MK
154.BR chmod (2),
155.BR openat (2),