mkfifo()

create FIFO special file 

Function


SYNOPSIS

#include <sys/types.h>

#include <sys/stat.h>

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


DESCRIPTION

The mkfifo() function creates a new FIFO special file named by the pathname that path name points to. The parameter mode initializes the file permission bits of the new FIFO. The file creation mask of the process (see umask()) modifies the file permission bits of mode.

The owner ID of the FIFO is set to the effective user ID of the process. The FIFO group ID is set to the effective group ID of the process.


PARAMETERS

pathname 

Specifies the name of the new FIFO. The path name must specify a path under the fifos subdirectory of the NuTCRACKER Platform installation directory. You can use the _NutQueryRootDir() function to obtain this path.

mode 

Specifies which access modes the FIFO has when it is created. Refer to the documentation for stat() for a discussion of access mode flags.


RETURN VALUES

If successful, mkfifo() returns zero. On failure, it returns -1, does not create the FIFO, and sets errno to one of the following values:

EACCES 

Search permission is denied on a component of the path prefix or write permission is denied on the parent directory of the file to be created.

EEXIST 

The named file already exists.

EINVAL 

pathname does not specify a path under the fifos subdirectory of the NuTCRACKER Platform installation directory.

ENAMETOOLONG 

The length of the pathname parameter exceeds PATH_MAX or a path name component is longer than NAME_MAX.

ENOENT 

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

ENOSPC 

The directory that contains 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.


CONFORMANCE

POSIX.1 (1996), with exceptions.


MULTITHREAD SAFETY LEVEL

Async-signal-safe.


PORTING ISSUES

The NuTCRACKER Platform requires that FIFOS be created under the fifos subdirectory of the NuTCRACKER Platform installation directory. The following code fragment shows an example of how to establish a valid path:

#include <nutc.h>
#include <sys/types.h>
#include <sys/stat.h>
...
sprintf(path, "%s/fifos/myfifo", _NutQueryRootDir(1));
mkfifo(path, 0666);
...

NuTCRACKER Platform FIFOs appear as regular files to non-NuTCRACKER Platform applications. If a non-NuTCRACKER Platform application writes to a FIFO, the FIFO is corrupted such that it no longer appears as a FIFO to NuTCRACKER Platform applications.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
chmod(), mknod(), stat(), umask()

Miscellaneous:
struct stat


PTC MKS Toolkit 10.2 Documentation Build 28.