OSDN Git Service

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