[PATCH 1/1] [PATCH]: pipe.7: read(2) returns with zero while the write end is closed.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Clarify that read(2) will return with zero if the write of the pipe is closed
and the pipe is empty, but will block (in case of blocking read) until data is
available, and fail with error EAGAIN (in case of non-blocking read) while the
write end of the empty pipe is open and the pipe is empty.

Signed-off-by: J.H. vd Water <henri.van.de.water@xxxxxxxxx>
---
 man7/pipe.7 | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/man7/pipe.7 b/man7/pipe.7
index 852cbd94f..4f3074879 100644
--- a/man7/pipe.7
+++ b/man7/pipe.7
@@ -49,9 +49,16 @@ they are created and opened.
 Once these tasks have been accomplished,
 I/O on pipes and FIFOs has exactly the same semantics.
 .PP
-If a process attempts to read from an empty pipe, then
+If a process attempts to read from an empty pipe while the write end
+is open, then
 .BR read (2)
-will block until data is available.
+will block (in case of blocking read(2) ), until data is available,
+and fail with error
+.BR EAGAIN
+(in case of non-blocking read(2) ); however, if the write end of the
+pipe is closed and the pipe is empty, then
+.BR read (2)
+will return with zero.
 If a process attempts to write to a full pipe (see below), then
 .BR write (2)
 blocks until sufficient data has been read from the pipe
-- 
2.38.1




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux