mknod(2)
NAME
mknod − make a directory, or a special or ordinary file
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
int mknod (path, mode, dev)
char ∗path;
mode_t 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:
S_IFMT file type; one of the following:
S_IFIFO fifo special
S_IFCHR character special
S_IFDIR directory
S_IFBLK block special
S_IFREG or 0 ordinary file
S_IFLNK symbolic link
S_IFSOCK socket
S_IXUSR set user ID on execution
S_IXGRP set group ID on execution
S_ISVTX save text image after execution
One of the following access permissions:
S_IRWXU read, write, execute by owner
S_IRUSR read permission by owner
S_IWUSR write permission by owner
S_IXUSR execute permission by owner
S_IRWXG read, write, execute by group
S_IRGRP read permission by group
S_IWGRP write permission by group
S_IXGRP execute permission by group
S_IRWXO read, write, execute by others
S_IROTH read permission by others
S_IWOTH write permission by others
S_IXOTH execute permission by others
S_ENFMT record locking enforced
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 access permission 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). 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.
mknod may be invoked only by the super-user for file types other than FIFO special.
mknod will fail and the new file will not be created if one or more of the following are true:
[EPERM] The effective user ID of the process is not super-user.
[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.
[EEXIST] The named file exists.
[EFAULT] Path points outside the allocated address space of the process.
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.
SEE ALSO
chmod(2), exec(2), umask(2), fs(4).
mkdir(1) in the CX/UX User’s Reference Manual.
CX/UX Programmer’s Reference Manual