MKNOD(2) — HP-UX
NAME
mknod − make a directory, or a special or ordinary file
SYNOPSIS
int mknod (path, mode, dev)
char ∗path;
int mode;
dev_t dev;
DESCRIPTION
Mknod creates a new file named by the path name pointed to by path. The mode of the new file is initialized from mode, where the value of mode is interpreted as follows:
0170000 file type; one of the following:
0010000 fifo special
0020000 character special
0040000 directory
0060000 block special
0100000 or 0000000 ordinary file
0004000 set user ID on execution
0002000 set group ID on execution
0002000 set file locking mode to enforced
0001000 save text image after execution
0000777 access 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
Values of mode other than those above are undefined and should not be used.
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.
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).
Dev is meaningful only if mode indicates a block or character special file, and is ignored otherwise. It is an implementation and configuration dependent specification of a character or block I/O device. Dev may be created by using the makedev macro defined in <sys/sysmacros.h>. The argument to makedev are the major and minor device numbers, the value and interpretation of which are implementation dependent. The result of makedev is an object of type dev_t.
Mknod may be invoked only by the super-user for file types other than FIFO special.
NETWORKING FEATURES
RFA
An additional value is available for network special files under file type. Its value is 0110000.
RETURN VALUE
Upon successful completion a value of 0 is returned. Otherwise, a value of −1 is returned and errno is set to indicate the error.
ERRORS
Mknod will fail and the new file will not be created if one or more of the following are true:
[ENOSPC] Not enough space on the file system.
[EPERM] The effective user ID of the process is not super-user, and the file type is not FIFO special.
[ENOTDIR] A component of the path prefix is not a directory.
[ENOENT] A component of the path prefix does not exist.
[EROFS] The directory in which the file is to be created is located on a read-only file system.
[EACCES] A component of the path prefix denies search permission.
[EEXIST] The named file exists.
[EFAULT] Path points outside the process’s allocated address space. The reliable detection of this error will be implementation dependent.
[ENOENT] Path is null.
[EACCES] Path is in a directory that denies write permission, mode is for fifo special file, and the caller is not super-user.
[ENAMETOOLONG] The path specified exceeds MAXPATHLEN characters.
[ELOOP] Too many symbolic links were encountered in translating the path name.
DEPENDENCIES
Series 300 Diskless
The mode value 0004000 is used to indicate a hidden directory (see cdf(4)).
AUTHOR
Mknod was developed by AT&T and HP.
SEE ALSO
mkdir(2), mkdir(1), mknod(1M), chmod(2), exec(2), umask(2), fs(4), mknod(4), cdf(4).
Hewlett-Packard Company — May 11, 2021