mkfifo()

NAME

mkfifo() - make a FIFO special file

SYNOPSIS

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

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

DESCRIPTION

The mkfifo() function creates a new FIFO special file pointed to by path. The file permission bits of the new FIFO are initialized from mode. The file permission bits of the mode argument are modified by the process' file creation mask.

When bits in mode other than the file permission bits are set, the effect is implementation-dependent.

The FIFO's user ID will be set to the process' effective user ID. The FIFO's group ID will be set to the group ID of the parent directory or to the effective group ID of the process.

Upon successful completion, mkfifo() will mark 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

Upon successful completion, 0 is returned. Otherwise, -1 is returned, no FIFO is created and errno is set to indicate the error.

ERRORS

The mkfifo() function will fail if:

[EACCES]
A component of the path prefix denies search permission, or write permission is denied on the parent directory of the FIFO to be created.
[EEXIST]
The named file already exists.
[ELOOP]
Too many symbolic links were encountered in resolving path.
[ENAMETOOLONG]
The length of the path argument exceeds {PATH_MAX} or a path name component is longer than {NAME_MAX}.
[ENOENT]
A component of the path prefix specified by path does not name an existing directory or path is an empty string.
[ENOSPC]
The directory that would contain the new file cannot be extended or 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.

The mkfifo() function may fail if:

[ENAMETOOLONG]
Path name resolution of a symbolic link produced an intermediate result whose length exceeds {PATH_MAX}.

SEE ALSO

umask(2)

DERIVATION

Derived from the POSIX.1-1988 standard.