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