]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/mkdirat.2
sync
[thirdparty/man-pages.git] / man2 / mkdirat.2
CommitLineData
4a929ee1
MK
1.\" Hey Emacs! This file is -*- nroff -*- source.
2.\"
3.\" This manpage is Copyright (C) 2006, Michael Kerrisk
4.\"
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
13.\"
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
21.\"
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
24.\"
25.\"
26.TH MKDIRAT 2 2006-04-06 "Linux 2.6.16" "Linux Programmer's Manual"
27.SH NAME
97c0488f 28mkdirat \- create a directory relative to a directory file descriptor
4a929ee1
MK
29.SH SYNOPSIS
30.nf
d44417fb 31.B #define _ATFILE_SOURCE
4a929ee1
MK
32.B #include <sys/stat.h>
33.sp
34.BI "int mkdirat(int " dirfd ", const char *" pathname ", mode_t " mode );
35.fi
36.SH DESCRIPTION
37The
38.BR mkdirat ()
39system call operates in exactly the same way as
40.BR mkdir (2),
41except for the differences described in this manual page.
42
43If the pathname given in
44.I pathname
45is relative, then it is interpreted relative to the directory
46referred to by the file descriptor
47.IR dirfd
48(rather than relative to the current working directory of
49the calling process, as is done by
50.BR mkdir (2)
51for a relative pathname).
52
1343b604 53If
4a929ee1
MK
54.I pathname
55is relative and
56.I dirfd
57is the special value
58.BR AT_FDCWD ,
7fe3091d
MK
59then
60.I pathname
61is interpreted relative to the current working
4a929ee1
MK
62directory of the calling process (like
63.BR mkdir (2)).
64
1343b604 65If
4a929ee1
MK
66.IR pathname
67is absolute, then
68.I dirfd
69is ignored.
70.SH "RETURN VALUE"
7fe3091d 71On success,
4a929ee1
MK
72.BR mkdirat ()
73returns 0.
74On error, \-1 is returned and
75.I errno
76is set to indicate the error.
77.SH ERRORS
78The same errors that occur for
79.BR mkdir (2)
80can also occur for
81.BR mkdirat ().
82The following additional errors can occur for
83.BR mkdirat ():
84.TP
85.B EBADF
86.I dirfd
87is not a valid file descriptor.
88.TP
89.B ENOTDIR
97c0488f 90.I pathname
b328773d 91is relative and
4a929ee1
MK
92.I dirfd
93is a file descriptor referring to a file other than a directory.
94.SH NOTES
95See
96.BR openat (2)
97for an explanation of the need for
98.BR mkdirat ().
99.SH "CONFORMING TO"
100This system call is non-standard but is proposed
101for inclusion in a future revision of POSIX.1.
102.SH VERSIONS
103.BR mkdirat ()
104was added to Linux in kernel 2.6.16.
105.SH "SEE ALSO"
106.BR mkdir (2),
107.BR openat (2),
108.BR path_resolution (2)