1MKFIFO(3) Linux Programmer's Manual MKFIFO(3)
2
3
4
6 mkfifo - make a FIFO special file (a named pipe)
7
9 #include <sys/types.h>
10 #include <sys/stat.h>
11
12 int mkfifo(const char *pathname, mode_t mode);
13
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
33 On success mkfifo() returns 0. In the case of an error, -1 is returned
34 (in which case, errno is set appropriately).
35
37 EACCES One of the directories in pathname did not allow search (exe‐
38 cute) permission.
39
40 EEXIST pathname already exists.
41
42 ENAMETOOLONG
43 Either the total length of pathname is greater than PATH_MAX, or
44 an individual filename component has a length greater than
45 NAME_MAX. In the GNU system, there is no imposed limit on over‐
46 all filename length, but some file systems may place limits on
47 the length of a component.
48
49 ENOENT A directory component in pathname does not exist or is a dan‐
50 gling symbolic link.
51
52 ENOSPC The directory or filesystem has no room for the new file.
53
54 ENOTDIR
55 A component used as a directory in pathname is not, in fact, a
56 directory.
57
58 EROFS pathname refers to a read-only filesystem.
59
61 POSIX.1-2001.
62
64 mkfifo(1), close(2), open(2), read(2), stat(2), umask(2), write(2),
65 mkfifoat(3), fifo(7)
66
67
68
69Linux 1.2.13 1995-09-03 MKFIFO(3)