1 .\" Copyright (c) 1980 Regents of the University of California.
2 .\" All rights reserved. The Berkeley software License Agreement
3 .\" specifies the terms and conditions for redistribution.
5 .\" @(#)mknod.2 6.4 (Berkeley) 5/23/86
7 .TH MKNOD 2 "May 23, 1986"
10 mknod, mkfifo \- make a special file
14 #include <sys/types.h>
18 int mknod(const char *\fIpath\fP, mode_t \fImode\fP, dev_t \fIdev\fP)
19 int mkfifo(const char *\fIpath\fP, mode_t \fImode\fP)
27 The mode of the new file
28 (including special file bits)
33 (The protection part of the mode
34 is modified by the process's mode mask (see
36 The first block pointer of the i-node
39 and is used to specify which device the special file
42 If mode indicates a block or character special file,
44 is the device number of a character or block I/O device.
45 The low eight bits of the device number hold the minor device number
46 that selects a device among the devices governed by the same driver.
47 The driver is selected by the major device number, the next eight bits
52 does not indicate a block special or character special device,
55 (For example, when creating a ``fifo'' special file.)
58 may be invoked only by the super-user,
59 unless it is being used to create a fifo.
62 .BI "mkfifo(" path ", " mode ")"
66 .BI "mknod(" path ", (" mode " & 0777) | S_IFIFO, 0)"
69 Upon successful completion a value of 0 is returned.
70 Otherwise, a value of \-1 is returned and \fBerrno\fP
71 is set to indicate the error.
74 will fail and the file mode will be unchanged if:
77 A component of the path prefix is not a directory.
80 The path name exceeds PATH_MAX characters.
83 A component of the path prefix does not exist.
86 Search permission is denied for a component of the path prefix.
89 Too many symbolic links were encountered in translating the pathname.
93 The process's effective user ID is not super-user.
96 An I/O error occurred while making the directory entry or allocating the inode.
99 The directory in which the entry for the new node is being placed
100 cannot be extended because there is no space left on the file
101 system containing the directory.
104 There are no free inodes on the file system on which the
105 node is being created.
109 The directory in which the entry for the new node
110 is being placed cannot be extended because the
111 user's quota of disk blocks on the file system
112 containing the directory has been exhausted.
115 The user's quota of inodes on the file system on
116 which the node is being created has been exhausted.
120 The named file resides on a read-only file system.
123 The named file exists.
127 points outside the process's allocated address space.