xref: /freebsd/sbin/mknod/mknod.8 (revision 734e82fe33aa764367791a7d603b383996c6b40b)
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.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
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.8	8.2 (Berkeley) 12/11/93
29.\"
30.Dd October 3, 2016
31.Dt MKNOD 8
32.Os
33.Sh NAME
34.Nm mknod
35.Nd build special file
36.Sh SYNOPSIS
37.Nm
38.Ar name
39.Nm
40.Ar name
41.Op Cm b | c
42.Ar major minor
43.Op Ar owner : Ns Ar group
44.Sh DESCRIPTION
45.Bf -symbolic
46The
47.Nm
48utility is deprecated on modern
49.Fx
50systems.
51.Ef
52.Pp
53The
54.Nm
55utility creates device special files.
56To make nodes manually, the arguments are:
57.Bl -tag -width indent
58.It Ar name
59Device name, for example
60.Pa /dev/da0
61for a SCSI disk or
62.Pa /dev/pts/0
63for pseudo-terminals.
64.It Cm b | c
65Type of device.
66If the
67device is a block type device such as a tape or disk drive which needs
68both cooked and raw special files,
69the type is
70.Cm b .
71All other devices are character type devices, such as terminal
72and pseudo devices, and are type
73.Cm c .
74.It Ar major
75The major device number is an integer number which tells the kernel
76which device driver entry point to use.
77.It Ar minor
78The minor device number tells the kernel which subunit
79the node corresponds to on the device; for example,
80a subunit may be a file system partition
81or a tty line.
82.It Ar owner : Ns Ar group
83The
84.Ar owner
85.Ar group
86operand pair is optional, however, if one is specified, they both must be
87specified.
88The
89.Ar owner
90may be either a numeric user ID or a user name.
91If a user name is also a numeric user ID, the operand is used as a
92user name.
93The
94.Ar group
95may be either a numeric group ID or a group name.
96Similar to the user name,
97if a group name is also a numeric group ID, the operand is used as a
98group name.
99.El
100.Pp
101Major and minor device numbers can be given in any format acceptable to
102.Xr strtoul 3 ,
103so that a leading
104.Ql 0x
105indicates a hexadecimal number, and a leading
106.Ql 0
107will cause the number to be interpreted as octal.
108.Pp
109The
110.Nm
111utility can be used to recreate deleted device nodes under a
112.Xr devfs 5
113mount point by invoking it with only a filename as an argument.
114Example:
115.Pp
116.Dl "mknod /dev/cd0"
117.Pp
118where
119.Pa /dev/cd0
120is the name of the deleted device node.
121.Sh COMPATIBILITY
122The
123.Xr chown 8 Ns - Ns
124like functionality is specific to
125.Fx .
126.Pp
127As of
128.Fx 4.0 ,
129block devices were deprecated in favour of character
130devices.
131As of
132.Fx 5.0 ,
133device nodes are managed by the device file system
134.Xr devfs 5 ,
135making the
136.Nm
137utility superfluous.
138As of
139.Fx 6.0
140device nodes may be created in regular file systems but such
141nodes cannot be used to access devices.
142.Sh SEE ALSO
143.Xr mkfifo 1 ,
144.Xr mknod 2 ,
145.Xr devfs 5 ,
146.Xr chown 8
147.Sh HISTORY
148A
149.Nm
150utility appeared in
151.At v4 .
152