Re: [PATCH v2] pipe.7: document read()s with O_NONBLOCK

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

 



On 2023-07-09 21:45, наб wrote:
> Which don't behave like you may expect them to.

What is the way that you expected or might have expected,
and how does this differ?  I'm curious.

> 
> Quoth Issue 8 Draft 3:
> 60746  When attempting to read from an empty pipe or FIFO:
> 60747    • If no process has the pipe open for writing, read( ) shall return 0 to indicate end-of-file.
> 60748    • If some process has the pipe open for writing and O_NONBLOCK is set, read( ) shall return
> 60749      −1 and set errno to [EAGAIN].
> 60750    • If some process has the pipe open for writing and O_NONBLOCK is clear, read( ) shall
> 60751      block the calling thread until some data is written or the pipe is closed by all processes that
> 60752      had the pipe open for writing.
> 
> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@xxxxxxxxxxxxxxxxxx>
> ---
> Killed the "oddities" line. But yes, I'm sure.
> /I/ had the luxury of knowing to go to the standard,
> other users will give up.

Ok.

Cheers,
Alex

> 
>  man7/pipe.7 | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/man7/pipe.7 b/man7/pipe.7
> index c3e06bdab..91554fa3c 100644
> --- a/man7/pipe.7
> +++ b/man7/pipe.7
> @@ -56,12 +56,19 @@ .SS I/O on pipes and FIFOs
>  .BR write (2)
>  blocks until sufficient data has been read from the pipe
>  to allow the write to complete.
> +.PP
>  Nonblocking I/O is possible by using the
>  .BR fcntl (2)
>  .B F_SETFL
>  operation to enable the
>  .B O_NONBLOCK
> -open file status flag.
> +open file status flag or by opening a
> +.BR fifo (7)
> +with
> +.BR O_NONBLOCK .
> +If any process has the pipe open for writing, reads fail with
> +.BR EAGAIN ;
> +otherwise\[em]with no potential writers\[em]reads succeed and return empty.
>  .PP
>  The communication channel provided by a pipe is a
>  .IR "byte stream" :

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

Attachment: OpenPGP_signature
Description: OpenPGP digital 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