OSDN Git Service

(split) LDP: Update original to LDP v3.50.
[linuxjm/LDP_man-pages.git] / original / man2 / mknodat.2
1 .\" This manpage is Copyright (C) 2006, Michael Kerrisk
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .TH MKNODAT 2 2012-05-04 "Linux" "Linux Programmer's Manual"
26 .SH NAME
27 mknodat \- create a special or ordinary file relative to a directory
28 file descriptor
29 .SH SYNOPSIS
30 .nf
31 .B #include <fcntl.h>           /* Definition of AT_* constants */
32 .B #include <sys/stat.h>
33 .sp
34 .BI "int mknodat(int " dirfd ", const char *" pathname ", mode_t " mode \
35 ", dev_t " dev );
36 .fi
37 .sp
38 .in -4n
39 Feature Test Macro Requirements for glibc (see
40 .BR feature_test_macros (7)):
41 .in
42 .sp
43 .BR mknodat ():
44 .PD 0
45 .ad l
46 .RS 4
47 .TP 4
48 Since glibc 2.10:
49  _XOPEN_SOURCE\ >=\ 700
50 .\" Other FTM combinations will also expose mknodat(), but this function was
51 .\" added in SUSv4, marked XSI, so we'll just document what the standard says.
52 .TP 4
53 Before glibc 2.10:
54 _ATFILE_SOURCE
55 .RE
56 .ad
57 .PD
58 .SH DESCRIPTION
59 The
60 .BR mknodat ()
61 system call operates in exactly the same way as
62 .BR mknod (2),
63 except for the differences described in this manual page.
64
65 If the pathname given in
66 .I pathname
67 is relative, then it is interpreted relative to the directory
68 referred to by the file descriptor
69 .I dirfd
70 (rather than relative to the current working directory of
71 the calling process, as is done by
72 .BR mknod (2)
73 for a relative pathname).
74
75 If
76 .I pathname
77 is relative and
78 .I dirfd
79 is the special value
80 .BR AT_FDCWD ,
81 then
82 .I pathname
83 is interpreted relative to the current working
84 directory of the calling process (like
85 .BR mknod (2)).
86
87 If
88 .I pathname
89 is absolute, then
90 .I dirfd
91 is ignored.
92 .SH RETURN VALUE
93 On success,
94 .BR mknodat ()
95 returns 0.
96 On error, \-1 is returned and
97 .I errno
98 is set to indicate the error.
99 .SH ERRORS
100 The same errors that occur for
101 .BR mknod (2)
102 can also occur for
103 .BR mknodat ().
104 The following additional errors can occur for
105 .BR mknodat ():
106 .TP
107 .B EBADF
108 .I dirfd
109 is not a valid file descriptor.
110 .TP
111 .B ENOTDIR
112 .I pathname
113 is relative and
114 .I dirfd
115 is a file descriptor referring to a file other than a directory.
116 .SH VERSIONS
117 .BR mknodat ()
118 was added to Linux in kernel 2.6.16;
119 library support was added to glibc in version 2.4.
120 .SH CONFORMING TO
121 POSIX.1-2008.
122 .SH NOTES
123 See
124 .BR openat (2)
125 for an explanation of the need for
126 .BR mknodat ().
127 .SH SEE ALSO
128 .BR mknod (2),
129 .BR openat (2),
130 .BR path_resolution (7)