1MKFIFO(3)                  Linux Programmer's Manual                 MKFIFO(3)
2
3
4

NAME

6       mkfifo - make a FIFO special file (a named pipe)
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <sys/stat.h>
11
12       int mkfifo(const char *pathname, mode_t mode);
13

DESCRIPTION

15       mkfifo()  makes a FIFO special file with name pathname.  mode specifies
16       the FIFO's permissions.  It is modified by the process's umask  in  the
17       usual way: the permissions of the created file are (mode & ~umask).
18
19       A  FIFO special file is similar to a pipe, except that it is created in
20       a different way.  Instead of being an anonymous communications channel,
21       a  FIFO  special  file  is  entered  into  the  file  system by calling
22       mkfifo().
23
24       Once you have created a FIFO special file in this way, any process  can
25       open  it  for  reading or writing, in the same way as an ordinary file.
26       However, it has to be open at both ends simultaneously before  you  can
27       proceed to do any input or output operations on it.  Opening a FIFO for
28       reading normally blocks until some other process opens  the  same  FIFO
29       for  writing, and vice versa.  See fifo(7) for non-blocking handling of
30       FIFO special files.
31

RETURN VALUE

33       On success mkfifo() returns 0.  In the case of an error, -1 is returned
34       (in which case, errno is set appropriately).
35

ERRORS

37       EACCES One  of  the  directories in pathname did not allow search (exe‐
38              cute) permission.
39
40       EEXIST pathname already exists.  This includes the case where  pathname
41              is a symbolic link, dangling or not.
42
43       ENAMETOOLONG
44              Either the total length of pathname is greater than PATH_MAX, or
45              an individual filename  component  has  a  length  greater  than
46              NAME_MAX.  In the GNU system, there is no imposed limit on over‐
47              all filename length, but some file systems may place  limits  on
48              the length of a component.
49
50       ENOENT A  directory  component  in pathname does not exist or is a dan‐
51              gling symbolic link.
52
53       ENOSPC The directory or file system has no room for the new file.
54
55       ENOTDIR
56              A component used as a directory in pathname is not, in  fact,  a
57              directory.
58
59       EROFS  pathname refers to a read-only file system.
60

CONFORMING TO

62       POSIX.1-2001.
63

SEE ALSO

65       mkfifo(1),  close(2),  open(2),  read(2),  stat(2), umask(2), write(2),
66       mkfifoat(3), fifo(7)
67

COLOPHON

69       This page is part of release 3.22 of the Linux  man-pages  project.   A
70       description  of  the project, and information about reporting bugs, can
71       be found at http://www.kernel.org/doc/man-pages/.
72
73
74
75GNU                               2008-06-12                         MKFIFO(3)
Impressum