xref: /freebsd/sbin/mknod/mknod.8 (revision 6990ffd8a95caaba6858ad44ff1b3157d1efba8f)
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. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"     @(#)mknod.8	8.2 (Berkeley) 12/11/93
33.\" $FreeBSD$
34.\"
35.Dd December 11, 1993
36.Dt MKNOD 8
37.Os
38.Sh NAME
39.Nm mknod
40.Nd build special file
41.Sh SYNOPSIS
42.Nm
43.Ar name
44.Op Cm c | Cm b
45.Ar major minor
46.Op Ar owner : Ns Ar group
47.Sh DESCRIPTION
48The
49.Nm
50command creates device special files.
51Normally the shell script
52.Pa /dev/MAKEDEV
53is used to create special files for commonly known devices; it executes
54.Nm
55with the appropriate arguments and can make all the files required for the
56device.
57.Pp
58To make nodes manually, the four required arguments are:
59.Pp
60.Bl -tag -width indent
61.It Ar name
62Device name, for example
63.Dq sd
64for a SCSI disk on an HP300 or a
65.Dq pty
66for pseudo-devices.
67.It Cm b | Cm c
68Type of device.
69If the
70device is a block type device such as a tape or disk drive which needs
71both cooked and raw special files,
72the type is
73.Cm b .
74All other devices are character type devices, such as terminal
75and pseudo devices, and are type
76.Cm c .
77.It Ar major
78The major device number is an integer number which tells the kernel
79which device driver entry point to use.  To learn what
80major device number to use for a particular device, check the file
81.Pa /dev/MAKEDEV
82to see if the device is known, or check
83the system dependent device configuration file:
84.Bd -ragged -offset indent
85.Dq Pa /usr/src/sys/conf/device. Ns Aq Ar architecture
86.Ed
87.Pp
88(for example
89.Pa device.hp300 ) .
90.It Ar minor
91The minor device number tells the kernel which subunit
92the node corresponds to on the device; for example,
93a subunit may be a filesystem partition
94or a tty line.
95.It Ar owner : Ns Ar group
96The
97.Ar owner
98.Ar group
99operand pair is optional, however, if one is specified, they both must be
100specified.
101The
102.Ar owner
103may be either a numeric user ID or a user name.
104If a user name is also a numeric user ID, the operand is used as a
105user name.
106The
107.Ar group
108may be either a numeric group ID or a group name.
109Similar to the user name,
110if a group name is also a numeric group ID, the operand is used as a
111group name.
112.El
113.Pp
114Major and minor device numbers can be given in any format acceptable to
115.Xr strtoul 3 ,
116so that a leading
117.Ql 0x
118indicates a hexadecimal number, and a leading
119.Ql 0
120will cause the number to be interpreted as octal.
121.Sh COMPATIBILITY
122The
123.Xr chown 8
124like functionality is specific to
125.Fx
126and was added so that
127.Pa /dev/MAKEDEV
128wound not depend on
129.Pa /usr
130being mounted.
131.Sh SEE ALSO
132.Xr mkfifo 1 ,
133.Xr mknod 2 ,
134.Xr chown 8 ,
135.Xr MAKEDEV 8
136.Sh HISTORY
137A
138.Nm
139command appeared in
140.At v6 .
141