MKNOD(2)
NAME
mknod − make a special file
USAGE
mknod(path, mode, dev) char *path; int mode, dev;
DESCRIPTION
Mknod creates a new file whose name is path. Mode sets the mode of the new file, including the special file bits. (The protection part of the mode is modified by the process’s mode mask; see umask(2)).
If mode indicates a block or character special file, dev is a configuration-dependent specification of a character or block I/O device. If mode does not indicate a block special or character special device, dev is ignored.
Use of mknod is limited to the super-user.
Mode is interpreted as follows: 0170000 file type; one of the following: 0010000 fifo special 0040000 directory 0100000 ordinary file 0000000 ordinary file
0004000set user ID on execution
0002000set group ID on execution
0000777access permissions; constructed from the following 0000400 read by owner 0000200 write by owner 0000100 execute (search on directory) by owner 0000070 read, write, execute (search) by group 0000007 read, write, execute (search) by others
The owner ID of the file is set to the effective user ID of the process. The group ID of the file is set to the effective group ID of the process.
Values of mode other than those above are undefined, and should not be used. The low-order 9 bits of mode are modified by the process’s file mode creation mask: all bits set in the process’s file mode creation mask are cleared. See umask(2).
NOTES
The DOMAIN System’s single level store architecture requires that all filesystem objects be readable in order to be writable or executable. Since write-only or execute-only files would be unusable in DOMAIN/IX, modes that specify 02 (write-only) or 01 (execute-only) are ORed with 0400 to force read permission. This applies to the owner, group, and world portions of the mode word. For example, if mode 0631 were specified, the mode applied to the file would actually be 0675.
RETURN VALUE
A successful call returns zero. A failed call returns -1 and sets errno as indicated below.
ERRORS
Mknod will fail if:
[EPERM] The process’s effective user ID is not super-user.
[EPERM] The pathname contains a character with the high-order bit set.
[ENOTDIR] A component of the path prefix is not a directory.
[ENOENT] A component of the path prefix does not exist.
[EROFS] The named file resides on a read-only file system.
[EEXIST] The named file exists.
[EFAULT] Path points outside the process’s allocated address space.
[ELOOP] The call encountered too many symbolic links in translating the pathname.