Commit | Line | Data |
---|---|---|
ef3c3516 KM |
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. | |
4 | .\" | |
fd690c8b | 5 | .\" @(#)mknod.2 6.3 (Berkeley) %G% |
ef3c3516 | 6 | .\" |
ea5a97a6 | 7 | .TH MKNOD 2 "" |
ef3c3516 KM |
8 | .UC 4 |
9 | .SH NAME | |
caa37210 | 10 | mknod \- make a special file |
ef3c3516 KM |
11 | .SH SYNOPSIS |
12 | .nf | |
caa37210 KM |
13 | .ft B |
14 | mknod(path, mode, dev) | |
15 | char *path; | |
16 | int mode, dev; | |
17 | .fi | |
18 | .ft R | |
ef3c3516 KM |
19 | .SH DESCRIPTION |
20 | .I Mknod | |
21 | creates a new file | |
caa37210 KM |
22 | whose name is |
23 | .I path. | |
ef3c3516 | 24 | The mode of the new file |
caa37210 | 25 | (including special file bits) |
ef3c3516 KM |
26 | is initialized from |
27 | .IR mode . | |
28 | (The protection part of the mode | |
29 | is modified by the process's mode mask; see | |
30 | .IR umask (2)). | |
31 | The first block pointer of the i-node | |
32 | is initialized from | |
caa37210 KM |
33 | .I dev |
34 | and is used to specify which device the special file | |
35 | refers to. | |
36 | .PP | |
37 | If mode indicates a block or character special file, | |
38 | .I dev | |
39 | is a configuration dependent specification of a character or block | |
40 | I/O device. If | |
41 | .I mode | |
42 | does not indicate a block special or character special device, | |
43 | .I dev | |
44 | is ignored. | |
ef3c3516 KM |
45 | .PP |
46 | .I Mknod | |
47 | may be invoked only by the super-user. | |
caa37210 KM |
48 | .SH "RETURN VALUE |
49 | Upon successful completion a value of 0 is returned. | |
50 | Otherwise, a value of \-1 is returned and \fIerrno\fP | |
51 | is set to indicate the error. | |
52 | .SH ERRORS | |
53 | .I Mknod | |
54 | will fail and the file mode will be unchanged if: | |
55 | .TP 15 | |
b5984ffe KM |
56 | [ENOTDIR] |
57 | A component of the path prefix is not a directory. | |
caa37210 | 58 | .TP 15 |
b5984ffe | 59 | [EINVAL] |
caa37210 KM |
60 | The pathname contains a character with the high-order bit set. |
61 | .TP 15 | |
b5984ffe KM |
62 | [ENAMETOOLONG] |
63 | A component of a pathname exceeded 255 characters, | |
64 | or an entire path name exceeded 1023 characters. | |
caa37210 KM |
65 | .TP 15 |
66 | [ENOENT] | |
67 | A component of the path prefix does not exist. | |
68 | .TP 15 | |
b5984ffe KM |
69 | [EACCES] |
70 | Search permission is denied for a component of the path prefix. | |
71 | .TP 15 | |
72 | [ELOOP] | |
73 | Too many symbolic links were encountered in translating the pathname. | |
74 | .TP 15 | |
75 | [EPERM] | |
76 | The process's effective user ID is not super-user. | |
77 | .TP 15 | |
78 | [EPERM] | |
79 | The pathname contains a character with the high-order bit set. | |
80 | .TP 15 | |
81 | [EIO] | |
82 | An I/O error occurred while making the directory entry or allocating the inode. | |
83 | .TP 15 | |
fd690c8b KM |
84 | [ENOSPC] |
85 | The directory in which the entry for the new node is being placed | |
86 | cannot be extended because there is no space left on the file | |
87 | system containing the directory. | |
88 | .TP 15 | |
89 | [ENOSPC] | |
90 | There are no free inodes on the file system on which the | |
91 | node is being created. | |
92 | .TP 15 | |
93 | [EDQUOT] | |
94 | The directory in which the entry for the new node | |
95 | is being placed cannot be extended because the | |
96 | user's quota of disk blocks on the file system | |
97 | containing the directory has been exhausted. | |
98 | .TP 15 | |
99 | [EDQUOT] | |
100 | The user's quota of inodes on the file system on | |
101 | which the node is being created has been exhausted. | |
102 | .TP 15 | |
caa37210 KM |
103 | [EROFS] |
104 | The named file resides on a read-only file system. | |
105 | .TP 15 | |
106 | [EEXIST] | |
107 | The named file exists. | |
108 | .TP 15 | |
109 | [EFAULT] | |
110 | .I Path | |
111 | points outside the process's allocated address space. | |
ef3c3516 | 112 | .SH "SEE ALSO" |
caa37210 | 113 | chmod(2), stat(2), umask(2) |