xref: /netbsd/sbin/mknod/mknod.8 (revision 6550d01e)
1.\"	$NetBSD: mknod.8,v 1.28 2004/06/17 21:30:14 dsl Exp $
2.\"
3.\" Copyright (c) 1980, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"     @(#)mknod.8	8.2 (Berkeley) 12/11/93
31.\"
32.Dd June 17, 2004
33.Dt MKNOD 8
34.Os
35.Sh NAME
36.Nm mknod
37.Nd make device special file
38.Sh SYNOPSIS
39.Nm
40.Op Fl rR
41.Op Fl F Ar fmt
42.Op Fl g Ar gid
43.Op Fl m Ar mode
44.Op Fl u Ar uid
45.Ar name
46.Op Cm c | Cm b
47.Op Ar driver | Ar major
48.Ar minor
49.Nm
50.Op Fl rR
51.Op Fl F Ar fmt
52.Op Fl g Ar gid
53.Op Fl m Ar mode
54.Op Fl u Ar uid
55.Ar name
56.Op Cm c | Cm b
57.Ar major unit subunit
58.Nm
59.Op Fl rR
60.Op Fl g Ar gid
61.Op Fl m Ar mode
62.Op Fl u Ar uid
63.Ar name
64.Op Cm c | Cm b
65.Ar number
66.Nm
67.Op Fl rR
68.Op Fl g Ar gid
69.Op Fl m Ar mode
70.Op Fl u Ar uid
71.Ar name
72.Cm p
73.Nm
74.Fl l
75.Sh DESCRIPTION
76The
77.Nm
78command creates device special files, or fifos.
79Normally the shell script
80.Pa /dev/MAKEDEV
81is used to create special files for commonly known devices; it executes
82.Nm
83with the appropriate arguments and can make all the files required for the
84device.
85.Pp
86To make nodes manually, the arguments are:
87.Pp
88.Bl -tag -width xmxmode
89.It Fl r
90Replace an existing file if its type is incorrect.
91.It Fl R
92Replace an existing file if its type is incorrect.
93Correct the mode, user and group.
94.It Fl F Ar fmt
95Create device nodes that may be used by an operating system which
96uses device numbers packed in a different format than
97.Nx
98uses.
99This is necessary when
100.Nx
101is used as an
102.Tn NFS
103server for netbooted computers running other operating systems.
104.Pp
105The following values for the
106.Ar fmt
107are recognized:
108.Sy native ,
109.Sy 386bsd ,
110.Sy 4bsd ,
111.Sy bsdos ,
112.Sy freebsd ,
113.Sy hpux ,
114.Sy isc ,
115.Sy linux ,
116.Sy netbsd ,
117.Sy osf1 ,
118.Sy sco ,
119.Sy solaris ,
120.Sy sunos ,
121.Sy svr3 ,
122.Sy svr4 ,
123and
124.Sy ultrix .
125.It Fl g Ar gid
126Specify the group for the device node.
127The
128.Ar gid
129operand may be a numeric group ID or a group name.
130If a group name is also a numeric group ID,
131the operand is used as a group name.
132Precede a numeric group ID with a
133.Cm #
134to stop it being treated as a name.
135.It Fl m Ar mode
136Specify the mode for the device node.
137The mode may be absolute or symbolic, see
138.Xr chmod 1 .
139.It Fl u Ar uid
140Specify the user for the device node.
141The
142.Ar uid
143operand may be a numeric user ID or a user name.
144If a user name is also a numeric user ID,
145the operand is used as a user name.
146Precede a numeric user ID with a
147.Cm #
148to stop it being treated as a name.
149.It Ar name
150Device name, for example
151.Dq sd
152for a SCSI disk on an HP300 or a
153.Dq pty
154for pseudo-devices.
155.It Cm b | Cm c | Cm p
156Type of device.
157If the device is a block type device such as a tape or disk drive
158which needs both cooked and raw special files, the type is
159.Cm b .
160All other devices are character type devices, such as terminal
161and pseudo devices, and are type
162.Cm c .
163Specifying
164.Cm p
165creates fifo files.
166.It Ar driver | Ar major
167The major device number is an integer number which tells the kernel
168which device driver entry point to use.
169If the device driver is configured into the current kernel it may be
170specified by driver name or major number.
171To find out which major device number to use for a particular device,
172use
173.Nm
174.Fl l ,
175check the file
176.Pa /dev/MAKEDEV
177to see if the device is known, or check
178the system dependent device configuration file:
179.Bd -filled -offset indent
180.Dq Pa /usr/src/sys/arch/\*[Lt]arch\*[Gt]/\*[Lt]arch\*[Gt]/conf.c
181.Ed
182.Pp
183.Po
184e.g.
185.Pa /usr/src/sys/arch/vax/vax/conf.c
186.Pc .
187.It Ar minor
188The minor device number tells the kernel which one of several similar
189devices the node corresponds to; for example, it may be a specific serial
190port or pty.
191.It Ar unit No and Ar subunit
192The unit and subunit numbers select a subset of a device; for example, the
193unit may specify a particular SCSI disk, and the subunit a partition on
194that disk.
195(Currently this form of specification is only supported by the
196.Ar bsdos
197format, for compatibility with the
198.Bsx
199.Nm ) .
200.It Ar number
201A single opaque device number.
202Useful for netbooted computers which require device numbers packed
203in a format that isn't supported by
204.Fl F .
205.It Fl l
206List the device drivers configured into the current kernel together with their
207block and character major numbers.
208.El
209.Sh SEE ALSO
210.Xr chmod 1 ,
211.Xr mkfifo 1 ,
212.Xr mkfifo 2 ,
213.Xr mknod 2 ,
214.Xr MAKEDEV 8
215.Sh HISTORY
216A
217.Nm
218command appeared in
219.At v6 .
220The
221.Fl F
222option appeared in
223.Nx 1.4 .
224The
225.Fl g , l , m , r , R ,
226and
227.Fl u
228options, and the ability to specify a driver by name appeared in
229.Nx 2.0 .
230