xref: /freebsd/sbin/mknod/mknod.8 (revision 2e3f49888ec8851bafb22011533217487764fdb0)
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.Dd October 3, 2016
29.Dt MKNOD 8
30.Os
31.Sh NAME
32.Nm mknod
33.Nd build special file
34.Sh SYNOPSIS
35.Nm
36.Ar name
37.Nm
38.Ar name
39.Op Cm b | c
40.Ar major minor
41.Op Ar owner : Ns Ar group
42.Sh DESCRIPTION
43.Bf -symbolic
44The
45.Nm
46utility is deprecated on modern
47.Fx
48systems.
49.Ef
50.Pp
51The
52.Nm
53utility creates device special files.
54To make nodes manually, the arguments are:
55.Bl -tag -width indent
56.It Ar name
57Device name, for example
58.Pa /dev/da0
59for a SCSI disk or
60.Pa /dev/pts/0
61for pseudo-terminals.
62.It Cm b | c
63Type of device.
64If the
65device is a block type device such as a tape or disk drive which needs
66both cooked and raw special files,
67the type is
68.Cm b .
69All other devices are character type devices, such as terminal
70and pseudo devices, and are type
71.Cm c .
72.It Ar major
73The major device number is an integer number which tells the kernel
74which device driver entry point to use.
75.It Ar minor
76The minor device number tells the kernel which subunit
77the node corresponds to on the device; for example,
78a subunit may be a file system partition
79or a tty line.
80.It Ar owner : Ns Ar group
81The
82.Ar owner
83.Ar group
84operand pair is optional, however, if one is specified, they both must be
85specified.
86The
87.Ar owner
88may be either a numeric user ID or a user name.
89If a user name is also a numeric user ID, the operand is used as a
90user name.
91The
92.Ar group
93may be either a numeric group ID or a group name.
94Similar to the user name,
95if a group name is also a numeric group ID, the operand is used as a
96group name.
97.El
98.Pp
99Major and minor device numbers can be given in any format acceptable to
100.Xr strtoul 3 ,
101so that a leading
102.Ql 0x
103indicates a hexadecimal number, and a leading
104.Ql 0
105will cause the number to be interpreted as octal.
106.Pp
107The
108.Nm
109utility can be used to recreate deleted device nodes under a
110.Xr devfs 5
111mount point by invoking it with only a filename as an argument.
112Example:
113.Pp
114.Dl "mknod /dev/cd0"
115.Pp
116where
117.Pa /dev/cd0
118is the name of the deleted device node.
119.Sh COMPATIBILITY
120The
121.Xr chown 8 Ns - Ns
122like functionality is specific to
123.Fx .
124.Pp
125As of
126.Fx 4.0 ,
127block devices were deprecated in favour of character
128devices.
129As of
130.Fx 5.0 ,
131device nodes are managed by the device file system
132.Xr devfs 5 ,
133making the
134.Nm
135utility superfluous.
136As of
137.Fx 6.0
138device nodes may be created in regular file systems but such
139nodes cannot be used to access devices.
140.Sh SEE ALSO
141.Xr mkfifo 1 ,
142.Xr mknod 2 ,
143.Xr devfs 5 ,
144.Xr chown 8
145.Sh HISTORY
146A
147.Nm
148utility appeared in
149.At v4 .
150