1MKDIRAT(2) Linux Programmer's Manual MKDIRAT(2)
2
3
4
6 mkdirat - create a directory relative to a directory file descriptor
7
9 #include <fcntl.h> /* Definition of AT_* constants */
10 #include <sys/stat.h>
11
12 int mkdirat(int dirfd, const char *pathname, mode_t mode);
13
14 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
15
16 mkdirat():
17 Since glibc 2.10:
18 _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
19 Before glibc 2.10:
20 _ATFILE_SOURCE
21
23 The mkdirat() system call operates in exactly the same way as mkdir(2),
24 except for the differences described in this manual page.
25
26 If the pathname given in pathname is relative, then it is interpreted
27 relative to the directory referred to by the file descriptor dirfd
28 (rather than relative to the current working directory of the calling
29 process, as is done by mkdir(2) for a relative pathname).
30
31 If pathname is relative and dirfd is the special value AT_FDCWD, then
32 pathname is interpreted relative to the current working directory of
33 the calling process (like mkdir(2)).
34
35 If pathname is absolute, then dirfd is ignored.
36
38 On success, mkdirat() returns 0. On error, -1 is returned and errno is
39 set to indicate the error.
40
42 The same errors that occur for mkdir(2) can also occur for mkdirat().
43 The following additional errors can occur for mkdirat():
44
45 EBADF dirfd is not a valid file descriptor.
46
47 ENOTDIR
48 pathname is relative and dirfd is a file descriptor referring to
49 a file other than a directory.
50
52 mkdirat() was added to Linux in kernel 2.6.16; library support was
53 added to glibc in version 2.4.
54
56 POSIX.1-2008.
57
59 See openat(2) for an explanation of the need for mkdirat().
60
62 mkdir(2), openat(2), path_resolution(7)
63
65 This page is part of release 3.53 of the Linux man-pages project. A
66 description of the project, and information about reporting bugs, can
67 be found at http://www.kernel.org/doc/man-pages/.
68
69
70
71Linux 2012-05-04 MKDIRAT(2)