xref: /freebsd/sbin/mknod/mknod.8 (revision 1a720cbec513210fa2e85c3882741ef2f6dc5f35)
18fae3551SRodney W. Grimes.\" Copyright (c) 1980, 1991, 1993
28fae3551SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
38fae3551SRodney W. Grimes.\"
48fae3551SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
58fae3551SRodney W. Grimes.\" modification, are permitted provided that the following conditions
68fae3551SRodney W. Grimes.\" are met:
78fae3551SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
88fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
98fae3551SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
108fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
118fae3551SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
138fae3551SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
148fae3551SRodney W. Grimes.\"    without specific prior written permission.
158fae3551SRodney W. Grimes.\"
168fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
178fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
188fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
198fae3551SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
208fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
218fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
228fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
238fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
248fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
258fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
268fae3551SRodney W. Grimes.\" SUCH DAMAGE.
278fae3551SRodney W. Grimes.\"
28db6df312SSevan Janiyan.Dd October 3, 2016
298fae3551SRodney W. Grimes.Dt MKNOD 8
309fe48c6eSRuslan Ermilov.Os
318fae3551SRodney W. Grimes.Sh NAME
328fae3551SRodney W. Grimes.Nm mknod
338fae3551SRodney W. Grimes.Nd build special file
348fae3551SRodney W. Grimes.Sh SYNOPSIS
357c7fb079SRuslan Ermilov.Nm
368fae3551SRodney W. Grimes.Ar name
3704e532d5SEd Schouten.Nm
3804e532d5SEd Schouten.Ar name
398d646af5SRuslan Ermilov.Op Cm b | c
408fae3551SRodney W. Grimes.Ar major minor
411252c1bbSRuslan Ermilov.Op Ar owner : Ns Ar group
428fae3551SRodney W. Grimes.Sh DESCRIPTION
43f33e5b1aSJoseph Koshy.Bf -symbolic
44f33e5b1aSJoseph KoshyThe
45f33e5b1aSJoseph Koshy.Nm
46f33e5b1aSJoseph Koshyutility is deprecated on modern
47f33e5b1aSJoseph Koshy.Fx
48f33e5b1aSJoseph Koshysystems.
49f33e5b1aSJoseph Koshy.Ef
50f33e5b1aSJoseph Koshy.Pp
518fae3551SRodney W. GrimesThe
527c7fb079SRuslan Ermilov.Nm
53e1205e80SPhilippe Charnierutility creates device special files.
5404e532d5SEd SchoutenTo make nodes manually, the arguments are:
55fbb3447fSPhilippe Charnier.Bl -tag -width indent
568fae3551SRodney W. Grimes.It Ar name
578fae3551SRodney W. GrimesDevice name, for example
5804e532d5SEd Schouten.Pa /dev/da0
5904e532d5SEd Schoutenfor a SCSI disk or
6004e532d5SEd Schouten.Pa /dev/pts/0
6121b4c1daSRuslan Ermilovfor pseudo-terminals.
628d646af5SRuslan Ermilov.It Cm b | c
63ef8f7ac9SSheldon HearnType of device.
64ef8f7ac9SSheldon HearnIf the
658fae3551SRodney W. Grimesdevice is a block type device such as a tape or disk drive which needs
668fae3551SRodney W. Grimesboth cooked and raw special files,
678fae3551SRodney W. Grimesthe type is
688fae3551SRodney W. Grimes.Cm b .
698fae3551SRodney W. GrimesAll other devices are character type devices, such as terminal
708fae3551SRodney W. Grimesand pseudo devices, and are type
718fae3551SRodney W. Grimes.Cm c .
728fae3551SRodney W. Grimes.It Ar major
738fae3551SRodney W. GrimesThe major device number is an integer number which tells the kernel
749806e231SRuslan Ermilovwhich device driver entry point to use.
758fae3551SRodney W. Grimes.It Ar minor
768fae3551SRodney W. GrimesThe minor device number tells the kernel which subunit
778fae3551SRodney W. Grimesthe node corresponds to on the device; for example,
788fae3551SRodney W. Grimesa subunit may be a file system partition
798fae3551SRodney W. Grimesor a tty line.
801252c1bbSRuslan Ermilov.It Ar owner : Ns Ar group
812dc15252SDavid E. O'BrienThe
822dc15252SDavid E. O'Brien.Ar owner
832dc15252SDavid E. O'Brien.Ar group
842dc15252SDavid E. O'Brienoperand pair is optional, however, if one is specified, they both must be
852dc15252SDavid E. O'Brienspecified.
862dc15252SDavid E. O'BrienThe
872dc15252SDavid E. O'Brien.Ar owner
882dc15252SDavid E. O'Brienmay be either a numeric user ID or a user name.
892dc15252SDavid E. O'BrienIf a user name is also a numeric user ID, the operand is used as a
902dc15252SDavid E. O'Brienuser name.
912dc15252SDavid E. O'BrienThe
922dc15252SDavid E. O'Brien.Ar group
932dc15252SDavid E. O'Brienmay be either a numeric group ID or a group name.
94d105b18bSMike PritchardSimilar to the user name,
952dc15252SDavid E. O'Brienif a group name is also a numeric group ID, the operand is used as a
962dc15252SDavid E. O'Briengroup name.
978fae3551SRodney W. Grimes.El
98ce6bb537SJoerg Wunsch.Pp
996ee990e0SBruce EvansMajor and minor device numbers can be given in any format acceptable to
1006ee990e0SBruce Evans.Xr strtoul 3 ,
1016ee990e0SBruce Evansso that a leading
102ce6bb537SJoerg Wunsch.Ql 0x
103ce6bb537SJoerg Wunschindicates a hexadecimal number, and a leading
104ce6bb537SJoerg Wunsch.Ql 0
105ce6bb537SJoerg Wunschwill cause the number to be interpreted as octal.
1068646bf9bSAlfred Perlstein.Pp
1078646bf9bSAlfred PerlsteinThe
1088646bf9bSAlfred Perlstein.Nm
109d04b5dfeSRuslan Ermilovutility can be used to recreate deleted device nodes under a
110*1a720cbeSAlexander Ziaee.Xr devfs 4
11104e532d5SEd Schoutenmount point by invoking it with only a filename as an argument.
112d04b5dfeSRuslan ErmilovExample:
1138646bf9bSAlfred Perlstein.Pp
11404e532d5SEd Schouten.Dl "mknod /dev/cd0"
115d04b5dfeSRuslan Ermilov.Pp
116d04b5dfeSRuslan Ermilovwhere
11704e532d5SEd Schouten.Pa /dev/cd0
1188646bf9bSAlfred Perlsteinis the name of the deleted device node.
1192dc15252SDavid E. O'Brien.Sh COMPATIBILITY
1202dc15252SDavid E. O'BrienThe
121a697e022SDima Dorfman.Xr chown 8 Ns - Ns
1222dc15252SDavid E. O'Brienlike functionality is specific to
123f91fdfd8STom Rhodes.Fx .
124f33e5b1aSJoseph Koshy.Pp
125f33e5b1aSJoseph KoshyAs of
126f33e5b1aSJoseph Koshy.Fx 4.0 ,
127f33e5b1aSJoseph Koshyblock devices were deprecated in favour of character
128f33e5b1aSJoseph Koshydevices.
129f33e5b1aSJoseph KoshyAs of
130f33e5b1aSJoseph Koshy.Fx 5.0 ,
131f33e5b1aSJoseph Koshydevice nodes are managed by the device file system
132*1a720cbeSAlexander Ziaee.Xr devfs 4 ,
133f33e5b1aSJoseph Koshymaking the
134f33e5b1aSJoseph Koshy.Nm
135f33e5b1aSJoseph Koshyutility superfluous.
136f33e5b1aSJoseph KoshyAs of
137f33e5b1aSJoseph Koshy.Fx 6.0
138f33e5b1aSJoseph Koshydevice nodes may be created in regular file systems but such
139f33e5b1aSJoseph Koshynodes cannot be used to access devices.
1408fae3551SRodney W. Grimes.Sh SEE ALSO
14121eab473SDavid E. O'Brien.Xr mkfifo 1 ,
1428fae3551SRodney W. Grimes.Xr mknod 2 ,
143*1a720cbeSAlexander Ziaee.Xr devfs 4 ,
144f91fdfd8STom Rhodes.Xr chown 8
1458fae3551SRodney W. Grimes.Sh HISTORY
1468fae3551SRodney W. GrimesA
1478fae3551SRodney W. Grimes.Nm
148e1205e80SPhilippe Charnierutility appeared in
149db6df312SSevan Janiyan.At v4 .
150