xref: /openbsd/sbin/mknod/mknod.8 (revision 133306f0)
1.\"	$OpenBSD: mknod.8,v 1.9 2000/03/18 22:55:59 aaron Exp $
2.\"	$NetBSD: mknod.8,v 1.9 1995/08/10 23:47:32 jtc Exp $
3.\"
4.\" Copyright (c) 1980, 1991, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"	This product includes software developed by the University of
18.\"	California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\"     @(#)mknod.8	8.2 (Berkeley) 12/11/93
36.\"
37.Dd April 18, 1999
38.Dt MKNOD 8
39.Os
40.Sh NAME
41.Nm mknod
42.Nd build special file
43.Sh SYNOPSIS
44.Nm mknod
45.Op Fl m Ar mode
46.Ar name
47.Op Cm c | Cm b
48.Ar major minor
49.Nm mknod
50.Op Fl m Ar mode
51.Ar name
52.Cm p
53.Sh DESCRIPTION
54The
55.Nm
56command creates device special files.
57Normally the shell script
58.Pa /dev/MAKEDEV
59is used to create special files for commonly known devices; it executes
60.Nm
61with the appropriate arguments and can make all the files required for the
62device.
63.Pp
64The options are as follows:
65.Bl -tag -width Ds
66.It Fl m Ar mode
67Set the file mode.
68.Ar mode
69may be absolute or symbolic, as described in
70.Xr chmod 1 .
71In symbolic mode strings, the
72.Ql +
73and
74.Ql -
75operators are interpreted relative to an assumed initial mode of
76.Dq a=rw .
77.El
78.Pp
79To make nodes manually, the arguments are:
80.Bl -tag -width majorx
81.It Ar name
82Device or FIFO name.
83For example
84.Dq sd
85for a SCSI disk or a
86.Dq pty
87for pseudo-devices.
88FIFOs may be named arbitrarily by the user.
89.It Cm b | Cm c | Cm p
90Type of device or FIFO.
91If the device is a block type device such as a tape or disk drive which needs
92both cooked and raw special files,
93the type is
94.Cm b .
95All other devices are character type devices, such as terminal
96and pseudo devices, and are type
97.Cm c .
98A FIFO (also known as a named pipe) is type
99.Cm p .
100.It Ar major
101The major device number is an integer number which tells the kernel
102which device driver entry point to use.
103To learn what major device number to use for a particular device,
104check the file
105.Pa /dev/MAKEDEV
106to see if the device is known.
107.It Ar minor
108The minor device number tells the kernel which subunit
109the node corresponds to on the device; for example,
110a subunit may be a filesystem partition
111or a tty line.
112.Pp
113Major and minor device numbers can be given in any format acceptable to
114.Xr strtoul 3 ,
115so that a leading
116.Dq 0x
117indicates a hexadecimal number, and a leading
118.Dq 0
119will cause the number to be interpreted as octal.
120.El
121.Sh SEE ALSO
122.Xr chmod 1 ,
123.Xr mkfifo 1 ,
124.Xr mkfifo 2 ,
125.Xr mknod 2 ,
126.Xr MAKEDEV 8
127.Sh HISTORY
128A
129.Nm
130command appeared in
131.At v6 .
132