up | Inhaltsverzeichniss | Kommentar

Manual page for MKNOD(2V)

mknod, mkfifo - make a special file

SYNOPSIS

#include <sys/types.h>
#include <sys/stat.h>

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

int mkfifo(path, mode)
char *path;
mode_t mode;

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_IFCHR	0020000	/* character special */
#define    S_IFBLK	0060000	/* block special */
#define    S_IFREG	0100000	/* regular */
#define    S_IFIFO	0010000	/* FIFO special */

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

The access permissions of the mode are modified by the process's mode mask (see umask.2v

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 either:

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.

mkfifo() creates a new FIFO special file named by the pathname pointed to by path. The access permissions of the new FIFO are initialized from mode. The access permissions of mode are modified by the process's file creation mask, see umask.2v Bits in mode other than the access permissions are ignored.

The FIFO's owner ID is set to the process's effective user ID. The FIFO's group ID is set to the group ID of the directory in which the FIFO is being created or to the process's effective group ID.

Upon successful completion, the mkfifo() function marks for update the st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and st_mtime fields of the directory that contains the new entry are marked for update.

RETURN VALUES

mknod() returns:

0
on success.
-1
on failure and sets errno to indicate the error.

mkfifo() returns:

0
on success.
-1
on failure and sets errno to indicate the error. No FIFO is created.

ERRORS

mknod() fails and the file mode remains unchanged if:

EACCES
Search permission is denied for a component of the path prefix of path.
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.
EEXIST
The file referred to by path exists.
EFAULT
path points outside the process's allocated address space.
EIO
An I/O error occurred while reading from or writing to the file system.
EISDIR
The specified mode would have created a directory.
ELOOP
Too many symbolic links were encountered in translating path.
ENAMETOOLONG
The length of the path argument exceeds {PATH_MAX}.

A pathname component is longer than {NAME_MAX} (see sysconf.2v while {_POSIX_NO_TRUNC} is in effect (see pathconf.2v

ENOENT
A component of the path prefix of path does not exist.
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.
ENOTDIR
A component of the path prefix of path is not a directory.
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.
EROFS
The file referred to by path resides on a read-only file system.

mkfifo() may set errno to:

EACCES
A component of the path prefix denies search permission.
EEXIST
The named file already exists.
ENAMETOOLONG
The length of the path string exceeds {PATH_MAX}.

A pathname component is longer than {NAME_MAX} while {_POSIX_NO_TRUNC} is in effect (see pathconf.2v

ENOENT
A component of the path prefix does not exist.

path points to an empty string.

ENOSPC
The directory that would contain the new file cannot be extended.

The file system is out of file allocation resources.

ENOTDIR
A component of the path prefix is not a directory.
EROFS
The named file resides on a read-only file system.

SEE ALSO

chmod.2v execve.2v pipe.2v stat.2v umask.2v write.2v


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97