Re: [PATCH v2] 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]

 



Hi,

On Tue, Nov 22, 2022 at 07:34:57PM +0100, J.H. van de Water wrote:
> 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.

Please use 72 columns only in the commit log.

> 
> 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

Please use semantic newlines.

$ MANWIDTH=72 man man-pages | sed -n '/Use semantic/,/^$/p'
   Use semantic newlines
       In the source of a manual page, new sentences should be started
       on  new  lines,  long  sentences  should be split into lines at
       clause breaks (commas, semicolons, colons, and so on), and long
       clauses should be split at phrase boundaries.  This convention,
       sometimes known as "semantic newlines", makes it easier to  see
       the  effect of patches, which often operate at the level of in‐
       dividual sentences, clauses, or phrases.

>  .BR read (2)
> -will block until data is available.
> +will block (in case of blocking read(2) ), until data is available,

There's a spurious space, and read(2) should be marked up.

> +and fail with error
> +.BR EAGAIN

.B not .BR

Thanks,
Alex

> +(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
> 

Attachment: signature.asc
Description: PGP signature


[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