312 lines
7.0 KiB
HTML
312 lines
7.0 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of MKFIFO</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>MKFIFO</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
mkfifo, mkfifoat - make a FIFO special file (a named pipe)
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/sys/types.h">sys/types.h</A>></B>
|
|
<B>#include <<A HREF="file:///usr/include/sys/stat.h">sys/stat.h</A>></B>
|
|
|
|
<B>int mkfifo(const char *</B><I>pathname</I><B>, mode_t </B><I>mode</I><B>);</B>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/fcntl.h">fcntl.h</A>> </B>/* Definition of AT_* constants */
|
|
<B>#include <<A HREF="file:///usr/include/sys/stat.h">sys/stat.h</A>></B>
|
|
|
|
<B>int mkfifoat(int </B><I>dirfd</I><B>, const char *</B><I>pathname</I><B>, mode_t </B><I>mode</I><B>);</B>
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
|
|
|
|
|
|
<P>
|
|
|
|
<B>mkfifoat</B>():
|
|
|
|
|
|
|
|
<DL COMPACT><DT id="1"><DD>
|
|
<DL COMPACT>
|
|
<DT id="2">Since glibc 2.10:<DD>
|
|
_POSIX_C_SOURCE >= 200809L
|
|
<DT id="3">Before glibc 2.10:<DD>
|
|
_ATFILE_SOURCE
|
|
</DL>
|
|
</DL>
|
|
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>mkfifo</B>()
|
|
|
|
makes a FIFO special file with name <I>pathname</I>.
|
|
<I>mode</I> specifies the FIFO's permissions.
|
|
It is modified by the
|
|
process's <B>umask</B> in the usual way: the permissions of the created
|
|
file are <B>(</B><I>mode</I><B> & ~umask)</B>.
|
|
<P>
|
|
|
|
A FIFO special file is similar to a pipe, except that it is created
|
|
in a different way.
|
|
Instead of being an anonymous communications
|
|
channel, a FIFO special file is entered into the filesystem by
|
|
calling
|
|
<B>mkfifo</B>().
|
|
|
|
<P>
|
|
|
|
Once you have created a FIFO special file in this way, any process can
|
|
open it for reading or writing, in the same way as an ordinary file.
|
|
However, it has to be open at both ends simultaneously before you can
|
|
proceed to do any input or output operations on it.
|
|
Opening a FIFO for reading normally blocks until some
|
|
other process opens the same FIFO for writing, and vice versa.
|
|
See
|
|
<B><A HREF="/cgi-bin/man/man2html?7+fifo">fifo</A></B>(7)
|
|
|
|
for nonblocking handling of FIFO special files.
|
|
<A NAME="lbAE"> </A>
|
|
<H3>mkfifoat()</H3>
|
|
|
|
The
|
|
<B>mkfifoat</B>()
|
|
|
|
function operates in exactly the same way as
|
|
<B>mkfifo</B>(),
|
|
|
|
except for the differences described here.
|
|
<P>
|
|
|
|
If the pathname given in
|
|
<I>pathname</I>
|
|
|
|
is relative, then it is interpreted relative to the directory
|
|
referred to by the file descriptor
|
|
<I>dirfd</I>
|
|
|
|
(rather than relative to the current working directory of
|
|
the calling process, as is done by
|
|
<B>mkfifo</B>()
|
|
|
|
for a relative pathname).
|
|
<P>
|
|
|
|
If
|
|
<I>pathname</I>
|
|
|
|
is relative and
|
|
<I>dirfd</I>
|
|
|
|
is the special value
|
|
<B>AT_FDCWD</B>,
|
|
|
|
then
|
|
<I>pathname</I>
|
|
|
|
is interpreted relative to the current working
|
|
directory of the calling process (like
|
|
<B>mkfifo</B>()).
|
|
|
|
<P>
|
|
|
|
If
|
|
<I>pathname</I>
|
|
|
|
is absolute, then
|
|
<I>dirfd</I>
|
|
|
|
is ignored.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success
|
|
<B>mkfifo</B>()
|
|
|
|
and
|
|
<B>mkfifoat</B>()
|
|
|
|
return 0.
|
|
In the case of an error, -1 is returned (in which case, <I>errno</I>
|
|
is set appropriately).
|
|
<A NAME="lbAG"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="4"><B>EACCES</B>
|
|
|
|
<DD>
|
|
One of the directories in <I>pathname</I> did not allow search
|
|
(execute) permission.
|
|
<DT id="5"><B>EDQUOT</B>
|
|
|
|
<DD>
|
|
The user's quota of disk blocks or inodes on the filesystem has been
|
|
exhausted.
|
|
<DT id="6"><B>EEXIST</B>
|
|
|
|
<DD>
|
|
<I>pathname</I> already exists.
|
|
This includes the case where
|
|
<I>pathname</I>
|
|
|
|
is a symbolic link, dangling or not.
|
|
<DT id="7"><B>ENAMETOOLONG</B>
|
|
|
|
<DD>
|
|
Either the total length of <I>pathname</I> is greater than
|
|
<B>PATH_MAX</B>, or an individual filename component has a length
|
|
greater than <B>NAME_MAX</B>.
|
|
In the GNU system, there is no imposed
|
|
limit on overall filename length, but some filesystems may place
|
|
limits on the length of a component.
|
|
<DT id="8"><B>ENOENT</B>
|
|
|
|
<DD>
|
|
A directory component in <I>pathname</I> does not exist or is a
|
|
dangling symbolic link.
|
|
<DT id="9"><B>ENOSPC</B>
|
|
|
|
<DD>
|
|
The directory or filesystem has no room for the new file.
|
|
<DT id="10"><B>ENOTDIR</B>
|
|
|
|
<DD>
|
|
A component used as a directory in <I>pathname</I> is not, in fact, a
|
|
directory.
|
|
<DT id="11"><B>EROFS</B>
|
|
|
|
<DD>
|
|
<I>pathname</I> refers to a read-only filesystem.
|
|
</DL>
|
|
<P>
|
|
|
|
The following additional errors can occur for
|
|
<B>mkfifoat</B>():
|
|
|
|
<DL COMPACT>
|
|
<DT id="12"><B>EBADF</B>
|
|
|
|
<DD>
|
|
<I>dirfd</I>
|
|
|
|
is not a valid file descriptor.
|
|
<DT id="13"><B>ENOTDIR</B>
|
|
|
|
<DD>
|
|
<I>pathname</I>
|
|
|
|
is a relative path and
|
|
<I>dirfd</I>
|
|
|
|
is a file descriptor referring to a file other than a directory.
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
<B>mkfifoat</B>()
|
|
|
|
was added to glibc in version 2.4.
|
|
It is implemented using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mknodat">mknodat</A></B>(2),
|
|
|
|
available on Linux since kernel 2.6.16.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>mkfifo</B>(),
|
|
|
|
<B>mkfifoat</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
<B>mkfifo</B>():
|
|
|
|
POSIX.1-2001, POSIX.1-2008.
|
|
<P>
|
|
|
|
<B>mkfifoat</B>():
|
|
|
|
POSIX.1-2008.
|
|
<A NAME="lbAK"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+mkfifo">mkfifo</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+close">close</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+read">read</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+stat">stat</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+umask">umask</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+write">write</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+fifo">fifo</A></B>(7)
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="14"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="15"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="16"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DL>
|
|
<DT id="17"><A HREF="#lbAE">mkfifoat()</A><DD>
|
|
</DL>
|
|
<DT id="18"><A HREF="#lbAF">RETURN VALUE</A><DD>
|
|
<DT id="19"><A HREF="#lbAG">ERRORS</A><DD>
|
|
<DT id="20"><A HREF="#lbAH">VERSIONS</A><DD>
|
|
<DT id="21"><A HREF="#lbAI">ATTRIBUTES</A><DD>
|
|
<DT id="22"><A HREF="#lbAJ">CONFORMING TO</A><DD>
|
|
<DT id="23"><A HREF="#lbAK">SEE ALSO</A><DD>
|
|
<DT id="24"><A HREF="#lbAL">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:48 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|