1MKDIRAT(2) Linux Programmer's Manual MKDIRAT(2)
2
3
4
6 mkdirat - create a directory relative to a directory file descriptor
7
9 #define _ATFILE_SOURCE
10 #include <fcntl.h> /* Definition of AT_* constants */
11 #include <sys/stat.h>
12
13 int mkdirat(int dirfd, const char *pathname, mode_t mode);
14
16 The mkdirat() system call operates in exactly the same way as mkdir(2),
17 except for the differences described in this manual page.
18
19 If the pathname given in pathname is relative, then it is interpreted
20 relative to the directory referred to by the file descriptor dirfd
21 (rather than relative to the current working directory of the calling
22 process, as is done by mkdir(2) for a relative pathname).
23
24 If pathname is relative and dirfd is the special value AT_FDCWD, then
25 pathname is interpreted relative to the current working directory of
26 the calling process (like mkdir(2)).
27
28 If pathname is absolute, then dirfd is ignored.
29
31 On success, mkdirat() returns 0. On error, -1 is returned and errno is
32 set to indicate the error.
33
35 The same errors that occur for mkdir(2) can also occur for mkdirat().
36 The following additional errors can occur for mkdirat():
37
38 EBADF dirfd is not a valid file descriptor.
39
40 ENOTDIR
41 pathname is relative and dirfd is a file descriptor referring to
42 a file other than a directory.
43
45 mkdirat() was added to Linux in kernel 2.6.16.
46
48 POSIX.1-2008.
49
51 See openat(2) for an explanation of the need for mkdirat().
52
54 mkdir(2), openat(2), path_resolution(7)
55
57 This page is part of release 3.22 of the Linux man-pages project. A
58 description of the project, and information about reporting bugs, can
59 be found at http://www.kernel.org/doc/man-pages/.
60
61
62
63Linux 2008-08-21 MKDIRAT(2)