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: _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
18 Before glibc 2.10: _ATFILE_SOURCE
19
21 The mkdirat() system call operates in exactly the same way as mkdir(2),
22 except for the differences described in this manual page.
23
24 If the pathname given in pathname is relative, then it is interpreted
25 relative to the directory referred to by the file descriptor dirfd
26 (rather than relative to the current working directory of the calling
27 process, as is done by mkdir(2) for a relative pathname).
28
29 If pathname is relative and dirfd is the special value AT_FDCWD, then
30 pathname is interpreted relative to the current working directory of
31 the calling process (like mkdir(2)).
32
33 If pathname is absolute, then dirfd is ignored.
34
36 On success, mkdirat() returns 0. On error, -1 is returned and errno is
37 set to indicate the error.
38
40 The same errors that occur for mkdir(2) can also occur for mkdirat().
41 The following additional errors can occur for mkdirat():
42
43 EBADF dirfd is not a valid file descriptor.
44
45 ENOTDIR
46 pathname is relative and dirfd is a file descriptor referring to
47 a file other than a directory.
48
50 mkdirat() was added to Linux in kernel 2.6.16.
51
53 POSIX.1-2008.
54
56 See openat(2) for an explanation of the need for mkdirat().
57
59 mkdir(2), openat(2), path_resolution(7)
60
62 This page is part of release 3.25 of the Linux man-pages project. A
63 description of the project, and information about reporting bugs, can
64 be found at http://www.kernel.org/doc/man-pages/.
65
66
67
68Linux 2009-12-13 MKDIRAT(2)