MKNOD(S) XENIX System V MKNOD(S)
Name
mknod - Makes a directory, or a special or ordinary file.
Syntax
int mknod (path, mode, dev)
char *path;
int mode, dev;
Description
mknod creates a new file named by the pathname 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 Named pipe special
0020000 Character special
0040000 Directory
0050000 Name special file
0060000 Block special
0100000 or 0000000 Ordinary file
0004000 Set user ID on execution
0002000 Set group ID on execution
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 file's owner ID is set to the process' effective user
ID. The file's group ID is set to the process' effective
group ID.
The low-order 9 bits of mode are modified by the process'
file mode creation mask: all bits set in the process' file
mode creation mask are cleared. See umask(S). If mode
indicates a block, character, or name special file, then dev
is a configuration-dependent specification of a character or
block I/O device. If mode does not indicate a block,
character, or name special file, then dev is ignored. For
block and character special files, dev is the special file's
device number. For name special files, dev is the type of
the name file, either a shared memory file or a semaphore.
Page 1 (printed 8/7/87)
MKNOD(S) XENIX System V MKNOD(S)
mknod may be invoked only by the super-user for file types
other than named pipe-special files.
mknod will fail and the new file will not be created if one
or more of the following are true:
The process' effective user ID is not super-user.
[EPERM]
A component of the path prefix is not a directory.
[ENOTDIR]
A component of the path prefix does not exist.
[ENOENT]
A component of the path prefix denies search
permission. [EACCES]
The directory in which the file is to be created is
located on a read-only file system. [EROFS]
The named file exists. [EEXIST]
path points outside the process' allocated address
space. [EFAULT]
The directory to contain the new file cannot be
extended. [ENOSPC]
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(S), creatsem(S), exec(S), filesystem(F), mkdir(C),
mknod(C), sdget(S), umask(S),
Notes
Semaphore files should be created with the creatsem(S)
system call.
Share data files should be created with the sdget(S) system
call.
Page 2 (printed 8/7/87)