mkfifo()

Create a FIFO special file

Synopsis:

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

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

Since:

BlackBerry 10.0.0

Arguments:

path
The pathname that you want to use for the FIFO special file.
mode
The file permission bits for the new FIFO. For more information, see " Access permissions " in the documentation for stat().

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

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).

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 filesystem 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 filesystem.

Examples:

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

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

    return EXIT_SUCCESS;
}

Classification:

POSIX 1003.1

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

Last modified: 2014-11-17



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus