1MKNOD(2) System Calls Manual MKNOD(2)
2
3
4
6 mknod - make a special file
7
9 mknod(path, mode, dev)
10 char *path;
11 int mode, dev;
12
14 Mknod creates a new file whose name is path. The mode of the new file
15 (including special file bits) is initialized from mode. (The protec‐
16 tion part of the mode is modified by the process's mode mask (see
17 umask(2))). The first block pointer of the i-node is initialized from
18 dev and is used to specify which device the special file refers to.
19
20 If mode indicates a block or character special file, dev is a configu‐
21 ration dependent specification of a character or block I/O device. If
22 mode does not indicate a block special or character special device, dev
23 is ignored.
24
25 Mknod may be invoked only by the super-user.
26
28 Upon successful completion a value of 0 is returned. Otherwise, a
29 value of -1 is returned and errno is set to indicate the error.
30
32 Mknod will fail and the file mode will be unchanged if:
33
34 [ENOTDIR] A component of the path prefix is not a directory.
35
36 [EINVAL] The pathname contains a character with the high-order
37 bit set.
38
39 [ENAMETOOLONG] A component of a pathname exceeded 255 characters, or an
40 entire path name exceeded 1023 characters.
41
42 [ENOENT] A component of the path prefix does not exist.
43
44 [EACCES] Search permission is denied for a component of the path
45 prefix.
46
47 [ELOOP] Too many symbolic links were encountered in translating
48 the pathname.
49
50 [EPERM] The process's effective user ID is not super-user.
51
52 [EPERM] The pathname contains a character with the high-order
53 bit set.
54
55 [EIO] An I/O error occurred while making the directory entry
56 or allocating the inode.
57
58 [ENOSPC] The directory in which the entry for the new node is
59 being placed cannot be extended because there is no
60 space left on the file system containing the directory.
61
62 [ENOSPC] There are no free inodes on the file system on which the
63 node is being created.
64
65 [EDQUOT] The directory in which the entry for the new node is
66 being placed cannot be extended because the user's quota
67 of disk blocks on the file system containing the direc‐
68 tory has been exhausted.
69
70 [EDQUOT] The user's quota of inodes on the file system on which
71 the node is being created has been exhausted.
72
73 [EROFS] The named file resides on a read-only file system.
74
75 [EEXIST] The named file exists.
76
77 [EFAULT] Path points outside the process's allocated address
78 space.
79
81 chmod(2), stat(2), umask(2)
82
83
84
854th Berkeley Distribution May 23, 1986 MKNOD(2)