OSDN Git Service

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