mkfifo -- make a FIFO special file


cc . . . -lc

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

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


The mkfifo routine creates a new FIFO special file named by the pathname specified by path. The permissions of the new FIFO are initialized from mode. The file permission bits of the mode argument are modified by the process's file creation mask (see umask(S). When bits in mode other than the file permission bits are set, the effect is implementation-defined.

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 the st_atime, st_ctime, and st_mtime fields of the file for update. Also, the st_ctime and st_mtime fields of the directory that contains the new entry are marked for update.

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


If any of the following conditions occur, the mkfifo function returns -1 and sets errno to the corresponding value:

A component of the path prefix denies search permission.

The named file already exists.

The length of the path string exceeds {PATH_MAX}, or a pathname component is longer than {NAME_MAX} while {_POSIX_NO_TRUNC} is in effect.

A component of the path prefix does not exist or the path argument points to an empty string.

The directory that would contain the new file cannot be extended or the file system is out of file allocation resources.

A component of the path prefix is not a directory.

The named file resides on a read-only file system.

See also

chmod(S), exec(S), pipe(S), stat(S), umask(S)

Standards conformance

mkfifo is conformant with:

IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) ;
and NIST FIPS 151-1 .

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003