mkfifo

Creates a new FIFO special file.

Library:LibC
Classification:POSIX
Service:File and Directory I/O

Syntax

  #include <sys/stat.h> 
   
  int mkfifo (
     const char   *pathname,
     mode_t        mode);
  

Parameters

pathname

(IN) Points to the path containing the new directory (either relative to the current working directory or an absolute pathname).

mode

(IN) Specifies the mode for the FIFO file (see File Access Modes and NetWare Attributes).

Return Values

If successful, returns 0. Otherwise, returns -1 and sets errno to one of the following:

Decimal

Constant

Description

1

ENOENT

A component of the path specified by pathname does not name an existing directory or pathname is an empty string.

6

EACCES

Search permission is denied on a component of pathname, or write permission is denied on the parent directory of the directory to be created.

7

EEXIST

The directory to create already exists.

12

ENOSPC

The file system does not contain enough space to hold the contents of the new directory or to extend the parent directory of the new directory.

65

ENAMETOOLONG

The length of the path argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.

67

ENOTDIR

A component of pathname is not a directory

76

EROFS

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

Remarks

A FIFO file is a special file in the file system that any process can open for reading and writing, just like any other file. However, it must be opened at both ends simultaneously before you can proceed to do any input or output operations on it. Opening a FIFO for reading normally blocks until some other process opens the same FIFO for writing, and vice versa

On NetWare file systems, the caller must have Create rights in the parent directory to use mkfifo to create a file. The inherited rights mask for the FIFO is ALL rights. You can use the mode parameter to set NetWare file attributes.

See Also