mkfifo - make a FIFO special file


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

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


     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  con-
     tains the new entry are marked for update.


     Upon successful completion, 0 is returned.  Otherwise, -1 is
     returned and errno is set to indicate the error.


     The mkfifo() function will fail if:

           A component of the path prefix denies  search  permis-
           sion,  or  write  permission  is  denied on the parent
           directory of the FIFO to be created.

           The named file already exists.

     ELOOP A loop exists in  symbolic  links  encountered  during
           resolution of the path argument.

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

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

           The directory that would contain the new  file  cannot
           be  extended  or  the  file  system  is  out  of file-
           allocation resources.

           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

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


     When a UFS file system is mounted with logging enabled, file
     system  transactions  that  free blocks from files might not
     actually add those freed blocks to the  file  system's  free
     list  until  some  unspecified  time  in  the  future.  This
     behavior improves file system performance but does not  con-
     form  to the POSIX, Single UNIX Specification, SPARC Confor-
     mance Definition, System  V  Application  Binary  Interface,
     System  V Interface Definition, and X/Open Portability Guide
     Standards, which  require  that  freed  space  be  available
     immediately.  To enable standards conformance regarding file
     deletions or to address the problem of  not  being  able  to
     grow  files  on a relatively full UFS file system even after
     files  have  been  deleted,   disable   UFS   logging   (see


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


     See attributes(5) for descriptions of the  following  attri-

    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    | Interface Stability         | Standard                    |
    | MT-Level                    | MT-Safe                     |


     mkdir(1),  mount_ufs(1M),   chmod(2),   exec(2),   mknod(2),
     umask(2), stat(3HEAD), ufs(7FS), attributes(5), standards(5)

Man(1) output converted with man2html