mkfifo(3c) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

mkfifo(3c)

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

NAME
       mkfifo, mkfifoat - make a FIFO special file

SYNOPSIS
       #include <sys/stat.h>

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


       int mkfifoat(int fd, 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 argu‐
       ment 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.


       The  mkfifoat()  function  is equivalent to mkfifo() except in the case
       where path specifies a relative path. In this case  the  newly  created
       FIFO  is created relative to the directory associated with the file de‐
       scriptor fd instead of the current working directory. If the  file  de‐
       scriptor  was  opened without O_SEARCH, the function checks whether di‐
       rectory searches are permitted using the current permissions of the di‐
       rectory underlying the file descriptor.  If  the  file  descriptor  was
       opened with O_SEARCH, the function does not perform the check.


       If mkfifoat() is passed the special value AT_FDCWD in the fd parameter,
       the  current  working directory is used and this is identical to a call
       to mkfifo().

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

ERRORS
       The mkfifo() and mkfifoat() functions will fail if:

       EACCES          A  component  of  the path prefix denies search permis‐
                       sion, or write permission is denied on the  parent  di‐
                       rectory of the FIFO to be created.


       EEXIST          The named file already exists.


       ELOOP           A loop exists in symbolic links encountered during res‐
                       olution 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 mkfifoat() function will fail if:

       EACCES    fd was not opened with O_SEARCH and the  permissions  of  the
                 directory underlying fd do not permit directory searches.


       EBADF     The  path  argument does not specify an absolute path and the
                 fd argument is neither AT_FDCWD nor a valid  file  descriptor
                 open for reading or searching.



       The mkfifo() and mkfifoat() functions 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}.



       The mkfifoat() function may fail if:

       ENOTDIR    The path argument is not an absolute path and fd is  neither
                  AT_FDCWD nor a file descriptor associated with a directory.


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/stat.h>
         int status;
         ...
         status = mkfifo("/home/cnd/mod_done", S_IWUSR | S_IRUSR |
                 S_IRGRP | S_IROTH);


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:

       tab()  box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
       TRIBUTE VALUE _ Interface  StabilityCommitted  _  MT-LevelAsync-Signal-
       Safe _ StandardSee standards(7).


SEE ALSO
       chmod(2),  exec(2),  mknod(2),  umask(2), stat.h(3HEAD), attributes(7),
       standards(7), mkfifo(8)

HISTORY
       The mkfifoat() function was added to Solaris in the  Solaris  11.0  re‐
       lease.


       The  mkfifo() function has been included in all Sun and Oracle releases
       of Solaris.

Oracle Solaris 11.4               27 Aug 2025                       mkfifo(3C)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3