Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(2)

stat(2)

umask(2)

MKNOD(2)  —  SYSTEM CALLS

NAME

mknod − make a special file

SYNOPSIS

#include <sys/stat.h>

mknod(path, mode, dev)
char ∗path;
int mode, dev;

DESCRIPTION

mknod creates a new file named by the path name pointed to by path. The mode of the new file (including file type bits) is initialized from mode. The values of the file type bits which are permitted are:

#define    S_IFCHR0020000/∗ character special ∗/
#define    S_IFBLK0060000/∗ block special ∗/
#define    S_IFREG0100000/∗ regular ∗/
#define    S_IFIFO0010000/∗ FIFO special ∗/

Values of mode other than those above are undefined and should not be used. 

The protection part of the mode is modified by the process’s mode mask (see umask(2)).

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 group ID of the parent directory. 

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. 

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 fails and the file mode remains unchanged if:

ENOTDIR A component of the path prefix of path is not a directory. 

EINVAL path contains a character with the high-order bit set. 

ENAMETOOLONG
The length of a component of path exceeds 255 characters, or the length of path exceeds 1023 characters. 

ENOENT A component of the path prefix of path does not exist. 

EACCES Search permission is denied for a component of the path prefix of path.

ELOOP Too many symbolic links were encountered in translating path.

EPERM An attempt was made to create a file of type other than FIFO special and the process’s effective user ID is not super-user. 

EIO An I/O error occurred while reading from or writing to the file system. 

EISDIR The specified mode would have created a directory. 

ENOSPC The directory in which the entry for the new file is being placed cannot be extended because there is no space left on the file system containing the directory. 

ENOSPC There are no free inodes on the file system on which the file is being created. 

EDQUOT The directory in which the entry for the new file is being placed cannot be extended because the user’s quota of disk blocks on the file system containing the directory has been exhausted. 

EDQUOT The user’s quota of inodes on the file system on which the node is being created has been exhausted. 

EROFS The file referred to by path resides on a read-only file system. 

EEXIST The file referred to by path exists. 

EFAULT path points outside the process’s allocated address space. 

SEE ALSO

chmod(2), stat(2), umask(2)

Sun Release 3.2  —  Last change: 16 July 1986

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026