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-osr5). 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-osr5), exec(S-osr5), pipe(S-osr5), stat(S-osr5), umask(S-osr5)

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 .

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005