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