HPlogo MPE/iX Developer's Kit Reference Manual Volume I: HP 3000 MPE/iX Computer Systems > Chapter 4  POSIX/iX Library Function Descriptions

mkfifo

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Make a FIFO special file.

Syntax

   #include <sys/types.h>

   #include <sys/stat.h>



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

Parameters

path

The pathname of a file.

mode

The access permission bits for the new directory. Access permission bits are set by ORing any combination of the following macros:

S_IRWXU

Set file owner class read, write, and execute (if a file) or search (if a directory) permission bits.

S_IRUSR

Set file owner class read permission bit.

S_IWUSR

Set file owner class write permission bit.

S_IXUSR

Set file owner class execute (if a file) or search (if a directory) permission bit.

S_IRWXG

Set file group class read, write, and execute (if a file) or search (if a directory) permission bits.

S_IRGRP

Set file group class read permission bit.

S_IWGRP

Set file group class write permission bit.

S_IXGRP

Set file group class execute (if a file) or search (if a directory) permission bit.

S_IRWXO

Set file other class read, write, and execute (if a file), or searc h (if a directory) permission bits.

S_IROTH

Set file other class read permission bit.

S_IWOTH

Set file other class write permission bit.

S_IXOTH

Set file other class execute (if a file) or search (if a directory) permission bit.

Unused bits of the mode parameter not associated with access permissions must contain zeros or an error occurs.

Return Values

0

Successful completion

-1

No FIFO is created, and errno is set to indicate the error.

Description

The mkfifo() routine creats a new FIFO special file named by the pathname pointed to by path. The file permission bits of th enew FIFO are initialized from mode. The fil epermission bits of the moide argument are modified by the fiel creation mask of the process. When bits in mode other than the file permission bits are set, the effect is implementation defined.

The owner ID of the FIFO shall be set to the effective user ID of the process. The group ID of the FIFO shall be set to the group ID of the directory in which the FIFO is being created or to the effective group ID of the process.

Upon successful completion, the mkfifo() function shall mark for update the st_atime, st_ctime, and st_mtime% fields of the file. Also, the st_ctime and the st_mtime fields of the directory taht contains the new entry are ;marked for update.

Implementation Considerations

None.

Errors

If any of the following conditions occur, the mkfifi9() function returns -1 and sets errno to the corresponding value.

EACCESCAUSESerach permission is denied on a compoenent of the path prefix, or wirte permission is denied on the parent directory of the file to be created.
 ACTIONMake sure that the calling process has search permission for all components of the pathname and write permission to the parent directory.
EEXISTCAUSEThe named file already exists.
 ACTIONMake sure that pathname specifies a directory that does not already exist.
ENAMETOOLONGCAUSEThe length of the path string exceeds [PATH_MAX] , or a pathname component is larger thatn [NAME_MAX] while {_POSIX_NO)TRUNC) is in effect.
 ACTIONMake sure that both the component's length and the full pathname length do not exceed the {NAME_MAX} or {PATH_MAX} limits.
ENOENTCAUSEA component of the path prefix does not exists, or the path argument points to an empty string.
 ACTIONSpecify a valid pathname.
ENOSPCCAUSEThe directory that would contain the new file cannot be extended, or the file system is out of file allocation resources.
 ACTIONExtend accounting limits for the directory in which the file is located, or fr ee up disk space.
ENOTDIRCAUSEA component of the path prefix is not a directory.
 ACTIONSpecify a valid pathname.
EROFSCAUSEThe named file resided on a read-only file system.
 ACTIONCreate the slink on a writable volume (file system).

See Also

chmod(), exec(), pipe(), stat(), <sys/stat.h>, umask(), POSIX.1

Feedback to webmaster