Skip to content

Commit 42f1e96

Browse files
author
Vladimir Kotal
committed
add another SIGPIPE example
1 parent 13afc2e commit 42f1e96

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

file-api.tex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,19 @@
407407
PIPE
408408
\end{verbatim}
409409

410+
Another possibility with named pipes:
411+
412+
\begin{verbatim}
413+
$ while [ 1 ]; do cat /etc/passwd; done >> /tmp/bigpasswd
414+
^C
415+
$ read < fifo &
416+
[1] 65946
417+
$ cat /tmp/bigpasswd > fifo
418+
[1]+ Done read < fifo
419+
$ echo $?
420+
141
421+
\end{verbatim}
422+
410423
\item When opening a pipe for writing only with \texttt{O\_NONBLOCK} and without
411424
an existing consumer, the call returns -1 and \texttt{errno} is set to
412425
\texttt{ENXIO}. This asymmetry in opening a pipe for reading in non-blocking

0 commit comments

Comments
 (0)