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 <sys/stat.h>
11
12 int mkdirat(int dirfd, const char *pathname, mode_t mode);
13
15 The mkdirat() system call operates in exactly the same way as mkdir(2),
16 except for the differences described in this manual page.
17
18 If the pathname given in pathname is relative, then it is interpreted
19 relative to the directory referred to by the file descriptor dirfd
20 (rather than relative to the current working directory of the calling
21 process, as is done by mkdir(2) for a relative pathname).
22
23 If pathname is relative and dirfd is the special value AT_FDCWD, then
24 pathname is interpreted relative to the current working directory of
25 the calling process (like mkdir(2)).
26
27 If pathname is absolute, then dirfd is ignored.
28
30 On success, mkdirat() returns 0. On error, -1 is returned and errno is
31 set to indicate the error.
32
34 The same errors that occur for mkdir(2) can also occur for mkdirat().
35 The following additional errors can occur for mkdirat():
36
37 EBADF dirfd is not a valid file descriptor.
38
39 ENOTDIR
40 pathname is relative and dirfd is a file descriptor referring to
41 a file other than a directory.
42
44 See openat(2) for an explanation of the need for mkdirat().
45
47 This system call is non-standard but is proposed for inclusion in a
48 future revision of POSIX.1.
49
51 mkdirat() was added to Linux in kernel 2.6.16.
52
54 mkdir(2), openat(2), path_resolution(2)
55
56
57
58Linux 2.6.16 2006-04-06 MKDIRAT(2)