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