Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mkfifo(3c) [sunos man page]

mkfifo(3C)						   Standard C Library Functions 						mkfifo(3C)

NAME
mkfifo - make 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. The file permission bits of the mode argument are modified by the process's file creation mask (see umask(2)). Bits other than the file permission bits in mode are ignored. If path names a symbolic link, mkfifo() fails and sets errno to EEXIST. The FIFO's user ID is set to the process's effective user ID. The FIFO's group ID is set to the group ID of the parent directory or to the effective group ID of the process. The mkfifo() function calls mknod(2) to create the file. Upon successful completion, mkfifo() marks for update the st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and st_mtime fields of the directory that contains the new entry are marked for update. RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The mkfifo() function will fail if: EACCES A component of the path prefix denies search permission, or write permission is denied on the parent directory of the FIFO to be created. EEXIST The named file already exists. ELOOP A loop exists in symbolic links encountered during resolution of the path argument. ENAMETOOLONG The length of the path argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}. ENOENT A component of the path prefix specified by path does not name an existing directory or path is 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. ENOTDIR A component of the path prefix is not a directory. EROFS The named file resides on a read-only file system. The mkfifo() function may fail if: ELOOP Too many symbolic links were encountered in resolving path. ENAMETOOLONG The length of the path argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}. EXAMPLES
Example 1: Create a FIFO File The following example demonstrates how to create a FIFO file named /home/cnd/mod_done with read and write permissions for the owner and read permissions for the group and others. #include sys/types.h> #include sys/stat.h> int status; ... status = mkfifo("/home/cnd/mod_done", S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH); ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
mkdir(1), chmod(2), exec(2), mknod(2), umask(2), stat.h(3HEAD), ufs(7FS), attributes(5), standards(5) SunOS 5.10 24 Apr 2002 mkfifo(3C)

Check Out this Related Man Page

MKFIFO(3)						     Linux Programmer's Manual							 MKFIFO(3)

NAME
mkfifo - make a FIFO special file (a named pipe) SYNOPSIS
#include <sys/types.h> #include <sys/stat.h> int mkfifo(const char *pathname, mode_t mode); DESCRIPTION
mkfifo makes a FIFO special file with name pathname. mode specifies the FIFO's permissions. It is modified by the process's umask in the usual way: the permissions of the created file are (mode & ~umask). A FIFO special file is similar to a pipe, except that it is created in a different way. Instead of being an anonymous communications chan- nel, a FIFO special file is entered into the file system by calling mkfifo. Once you have created a FIFO special file in this way, any process can open it for reading or writing, in the same way as an ordinary file. However, it has to be open 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. See fifo(4) for non-blocking handling of FIFO special files. RETURN VALUE
The normal, successful return value from mkfifo is 0. In the case of an error, -1 is returned (in which case, errno is set appropriately). ERRORS
EACCES One of the directories in pathname did not allow search (execute) permission. EEXIST pathname already exists. ENAMETOOLONG Either the total length of pathname is greater than PATH_MAX, or an individual file name component has a length greater than NAME_MAX. In the GNU system, there is no imposed limit on overall file name length, but some file systems may place limits on the length of a component. ENOENT A directory component in pathname does not exist or is a dangling symbolic link. ENOSPC The directory or filesystem has no room for the new file. ENOTDIR A component used as a directory in pathname is not, in fact, a directory. EROFS pathname refers to a read-only filesystem. CONFORMING TO
POSIX.1 SEE ALSO
mkfifo(1), read(2), write(2), open(2), close(2), stat(2), umask(2), fifo(4) Linux 1.2.13 1995-09-03 MKFIFO(3)
Man Page