Deleted Added
full compact
mknod.2 (165903) mknod.2 (178245)
1.\" Copyright (c) 1980, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 12 unchanged lines hidden (view full) ---

21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\" @(#)mknod.2 8.1 (Berkeley) 6/4/93
1.\" Copyright (c) 1980, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 12 unchanged lines hidden (view full) ---

21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\" @(#)mknod.2 8.1 (Berkeley) 6/4/93
29.\" $FreeBSD: head/lib/libc/sys/mknod.2 165903 2007-01-09 00:28:16Z imp $
29.\" $FreeBSD: head/lib/libc/sys/mknod.2 178245 2008-04-16 13:03:12Z kib $
30.\"
30.\"
31.Dd June 4, 1993
31.Dd April 10, 2008
32.Dt MKNOD 2
33.Os
34.Sh NAME
32.Dt MKNOD 2
33.Os
34.Sh NAME
35.Nm mknod
35.Nm mknod ,
36.Nm mknodat
36.Nd make a special file node
37.Sh LIBRARY
38.Lb libc
39.Sh SYNOPSIS
40.In unistd.h
41.Ft int
42.Fn mknod "const char *path" "mode_t mode" "dev_t dev"
37.Nd make a special file node
38.Sh LIBRARY
39.Lb libc
40.Sh SYNOPSIS
41.In unistd.h
42.Ft int
43.Fn mknod "const char *path" "mode_t mode" "dev_t dev"
44.Ft int
45.Fn mknodat "int fd" "const char *path" "mode_t mode" "dev_t dev"
43.Sh DESCRIPTION
44The file system node
45.Fa path
46is created with the file type and access permissions specified in
47.Fa mode .
48The access permissions are modified by the process's umask value.
49.Pp
50If

--- 5 unchanged lines hidden (view full) ---

56Otherwise,
57.Fa dev
58is ignored.
59.Pp
60The
61.Fn mknod
62system call
63requires super-user privileges.
46.Sh DESCRIPTION
47The file system node
48.Fa path
49is created with the file type and access permissions specified in
50.Fa mode .
51The access permissions are modified by the process's umask value.
52.Pp
53If

--- 5 unchanged lines hidden (view full) ---

59Otherwise,
60.Fa dev
61is ignored.
62.Pp
63The
64.Fn mknod
65system call
66requires super-user privileges.
67.Pp
68The
69.Fn mknodat
70system call is equivalent to
71.Fn mknod
72except in the case where
73.Fa path
74specifies a relative path.
75In this case the newly created device node is created relative to the
76directory associated with the file descriptor
77.Fa fd
78instead of the current working directory.
79If
80.Fn mknodat
81is passed the special value
82.Dv AT_FDCWD
83in the
84.Fa fd
85parameter, the current working directory is used and the behavior is
86identical to a call to
87.Fn mknod .
64.Sh RETURN VALUES
65.Rv -std mknod
66.Sh ERRORS
67The
68.Fn mknod
69system call
70will fail and the file will be not created if:
71.Bl -tag -width Er

--- 37 unchanged lines hidden (view full) ---

109argument
110points outside the process's allocated address space.
111.It Bq Er EINVAL
112Creating anything else than a block or character special
113file (or a
114.Em whiteout )
115is not supported.
116.El
88.Sh RETURN VALUES
89.Rv -std mknod
90.Sh ERRORS
91The
92.Fn mknod
93system call
94will fail and the file will be not created if:
95.Bl -tag -width Er

--- 37 unchanged lines hidden (view full) ---

133argument
134points outside the process's allocated address space.
135.It Bq Er EINVAL
136Creating anything else than a block or character special
137file (or a
138.Em whiteout )
139is not supported.
140.El
141.Pp
142In addition to the errors returned by the
143.Fn mknod ,
144the
145.Fn mknodat
146may fail if:
147.Bl -tag -width Er
148.It Bq Er EBADF
149The
150.Fa path
151argument does not specify an absolute path and the
152.Fa fd
153argument is neither
154.Dv AT_FDCWD
155nor a valid file descriptor open for searching.
156.It Bq Er ENOTDIR
157The
158.Fa path
159argument is not an absolute path and
160.Fa fd
161is neither
162.Dv AT_FDCWD
163nor a file descriptor associated with a directory.
164.El
117.Sh SEE ALSO
118.Xr chmod 2 ,
119.Xr mkfifo 2 ,
120.Xr stat 2 ,
121.Xr umask 2
165.Sh SEE ALSO
166.Xr chmod 2 ,
167.Xr mkfifo 2 ,
168.Xr stat 2 ,
169.Xr umask 2
170.Sh STANDARDS
171The
172.Fn mknodat
173system call follows The Open Group Extended API Set 2 specification.
122.Sh HISTORY
123The
124.Fn mknod
125function appeared in
126.At v6 .
174.Sh HISTORY
175The
176.Fn mknod
177function appeared in
178.At v6 .
179The
180.Fn mknodat
181system call appeared in
182.Fx 8.0 .