[Previous]
[Contents]
[Next]

mkfifo()

create 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 named by the pathname pointed to by path. The file permission bits of the new FIFO are initialized from mode, modified by the process's creation mask (see umask()). Bits that are set in mode other than the file permission bits are ignored.

The FIFO owner ID is set to the process's effective user ID and the FIFO's group ID is set to the process's effective group ID.

If mkfifo() succeeds, the st_ftime, st_ctime, st_atime and st_mtime fields of the file are marked for update. Also, the st_ctime and st_mtime fields of the directory that contains the new entry are marked for update.

Returns:

0
Success
-1
An error occurred. errno is set to indicate the error.

Errors:

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, or a pathname component is longer than NAME_MAX.
ENOENT
A component of the path prefix doesn't exist, or the path arguments points to 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 (that is, the disk is full).
ENOSYS
This function isn't supported for this path.
ENOTDIR
A component of the path prefix isn't a directory.
EROFS
The named file resides on a read-only file system.

Examples:

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

void main()
  {
    mkfifo( "//2/hd/qnx", S_IRUSR | S_IWUSR );
  }

Classification:

POSIX 1003.1

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

chmod(), errno, mknod(), pipe(), stat(), umask()


[Previous]
[Contents]
[Next]