Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/pipe.html
2024-02-19 00:21:47 -05:00

144 lines
5.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
<title>pipe</title>
</head>
<body bgcolor="white">
<basefont size="3"> <a name="pipe"></a> <a name="tag_03_418"></a><!-- pipe -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_418_01"></a>NAME</h4>
<blockquote>pipe - create an interprocess channel</blockquote>
<h4><a name="tag_03_418_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<p><code><tt>#include &lt;<a href="../basedefs/unistd.h.html">unistd.h</a>&gt;<br>
<br>
int pipe(int</tt> <i>fildes</i><tt>[2]);<br>
</tt></code></p>
</blockquote>
<h4><a name="tag_03_418_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>pipe</i>() function shall create a pipe and place two file descriptors, one each into the arguments <i>fildes</i>[0] and
<i>fildes</i>[1], that refer to the open file descriptions for the read and write ends of the pipe. Their integer values shall be
the two lowest available at the time of the <i>pipe</i>() call. The O_NONBLOCK and FD_CLOEXEC flags shall be clear on both file
descriptors. (The <a href="../functions/fcntl.html"><i>fcntl</i>()</a> function can be used to set both these flags.)</p>
<p>Data can be written to the file descriptor <i>fildes</i>[1] and read from the file descriptor <i>fildes</i>[0]. A read on the
file descriptor <i>fildes</i>[0] shall access data written to the file descriptor <i>fildes</i>[1] on a first-in-first-out basis.
It is unspecified whether <i>fildes</i>[0] is also open for writing and whether <i>fildes</i>[1] is also open for reading.</p>
<p>A process has the pipe open for reading (correspondingly writing) if it has a file descriptor open that refers to the read end,
<i>fildes</i>[0] (write end, <i>fildes</i>[1]).</p>
<p>Upon successful completion, <i>pipe</i>() shall mark for update the <i>st_atime</i>, <i>st_ctime</i>, and <i>st_mtime</i> fields
of the pipe.</p>
</blockquote>
<h4><a name="tag_03_418_04"></a>RETURN VALUE</h4>
<blockquote>
<p>Upon successful completion, 0 shall be returned; otherwise, -1 shall be returned and <i>errno</i> set to indicate the error.</p>
</blockquote>
<h4><a name="tag_03_418_05"></a>ERRORS</h4>
<blockquote>
<p>The <i>pipe</i>() function shall fail if:</p>
<dl compact>
<dt>[EMFILE]</dt>
<dd>More than {OPEN_MAX} minus two file descriptors are already in use by this process.</dd>
<dt>[ENFILE]</dt>
<dd>The number of simultaneously open files in the system would exceed a system-imposed limit.</dd>
</dl>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_03_418_06"></a>EXAMPLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_418_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_418_08"></a>RATIONALE</h4>
<blockquote>
<p>The wording carefully avoids using the verb &quot;to open&quot; in order to avoid any implication of use of <a href=
"../functions/open.html"><i>open</i>()</a>; see also <a href="write.html"><i>write</i>()</a> .</p>
</blockquote>
<h4><a name="tag_03_418_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_418_10"></a>SEE ALSO</h4>
<blockquote>
<p><a href="fcntl.html"><i>fcntl</i>()</a> , <a href="read.html"><i>read</i>()</a> , <a href="write.html"><i>write</i>()</a> , the
Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/fcntl.h.html"><i>&lt;fcntl.h&gt;</i></a>, <a href=
"../basedefs/unistd.h.html"><i>&lt;unistd.h&gt;</i></a></p>
</blockquote>
<h4><a name="tag_03_418_11"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 1. Derived from Issue 1 of the SVID.</p>
</blockquote>
<h4><a name="tag_03_418_12"></a>Issue 6</h4>
<blockquote>
<p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p>
<ul>
<li>
<p>The DESCRIPTION is updated to indicate that certain dispositions of <i>fildes</i>[0] and <i>fildes</i>[1] are unspecified.</p>
</li>
</ul>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; is a registered Trademark of The IEEE.<br>
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
]</font></center>
<!--footer end-->
<hr size="2" noshade>
</body>
</html>