]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/mkdirat.2
ldd.1, arch_prctl.2, faccessat.2, fchmodat.2, fchownat.2, flock.2, futimesat.2, getcp...
[thirdparty/man-pages.git] / man2 / mkdirat.2
CommitLineData
4a929ee1
MK
1.\" This manpage is Copyright (C) 2006, Michael Kerrisk
2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
4a929ee1
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.\"
4a929ee1
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.\"
4a929ee1
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
4a929ee1 24.\"
c95b6ae1 25.TH MKDIRAT 2 2012-05-04 "Linux" "Linux Programmer's Manual"
4a929ee1 26.SH NAME
97c0488f 27mkdirat \- create a directory relative to a directory file descriptor
4a929ee1
MK
28.SH SYNOPSIS
29.nf
5c108873 30.B #include <fcntl.h> /* Definition of AT_* constants */
4a929ee1
MK
31.B #include <sys/stat.h>
32.sp
33.BI "int mkdirat(int " dirfd ", const char *" pathname ", mode_t " mode );
34.fi
7cc796ee
MK
35.sp
36.in -4n
37Feature Test Macro Requirements for glibc (see
38.BR feature_test_macros (7)):
39.in
40.sp
41.BR mkdirat ():
37877088
MK
42.PD 0
43.ad l
44.RS 4
45.TP 4
46Since glibc 2.10:
47_XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
48.TP
7cc796ee
MK
49Before glibc 2.10:
50_ATFILE_SOURCE
37877088
MK
51.RE
52.ad
53.PD
4a929ee1
MK
54.SH DESCRIPTION
55The
56.BR mkdirat ()
57system call operates in exactly the same way as
58.BR mkdir (2),
59except for the differences described in this manual page.
60
c13182ef 61If the pathname given in
4a929ee1
MK
62.I pathname
63is relative, then it is interpreted relative to the directory
64referred to by the file descriptor
0daa9e92 65.I dirfd
c13182ef 66(rather than relative to the current working directory of
4a929ee1
MK
67the calling process, as is done by
68.BR mkdir (2)
69for a relative pathname).
70
1343b604 71If
4a929ee1 72.I pathname
c13182ef 73is relative and
4a929ee1
MK
74.I dirfd
75is the special value
76.BR AT_FDCWD ,
7fe3091d
MK
77then
78.I pathname
c13182ef 79is interpreted relative to the current working
4a929ee1
MK
80directory of the calling process (like
81.BR mkdir (2)).
82
1343b604 83If
0daa9e92 84.I pathname
c13182ef
MK
85is absolute, then
86.I dirfd
4a929ee1 87is ignored.
47297adb 88.SH RETURN VALUE
7fe3091d 89On success,
c13182ef
MK
90.BR mkdirat ()
91returns 0.
4a929ee1
MK
92On error, \-1 is returned and
93.I errno
94is set to indicate the error.
95.SH ERRORS
96The same errors that occur for
97.BR mkdir (2)
98can also occur for
99.BR mkdirat ().
c13182ef 100The following additional errors can occur for
4a929ee1
MK
101.BR mkdirat ():
102.TP
103.B EBADF
104.I dirfd
105is not a valid file descriptor.
106.TP
107.B ENOTDIR
97c0488f 108.I pathname
b328773d 109is relative and
4a929ee1
MK
110.I dirfd
111is a file descriptor referring to a file other than a directory.
a1d5f77c
MK
112.SH VERSIONS
113.BR mkdirat ()
c95b6ae1
MK
114was added to Linux in kernel 2.6.16;
115library support was added to glibc in version 2.4.
47297adb 116.SH CONFORMING TO
5144e45f 117POSIX.1-2008.
4a929ee1
MK
118.SH NOTES
119See
120.BR openat (2)
121for an explanation of the need for
122.BR mkdirat ().
47297adb 123.SH SEE ALSO
4a929ee1
MK
124.BR mkdir (2),
125.BR openat (2),
ad7cc990 126.BR path_resolution (7)