Re: Fwd: Simple changes to select(2) and pipe(7) - example program

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

 



-------- Forwarded Message --------
Subject: Re: Simple changes to select(2) and pipe(7)
Date: Tue, 8 Nov 2022 15:58:16 +0100
From: J.H. vd Water <henri.van.de.water@xxxxxxxxx>
To: Alejandro Colomar <alx.manpages@xxxxxxxxx>
CC: mtk.manpages@xxxxxxxxx

On 11/8/22 13:20, Alejandro Colomar wrote:
> On 11/6/22 19:53, J.H. vd Water wrote:
[snip]

>> man 2 select  ... DESCRIPTION reads:
>>
>> "select() allows a program to monitor multiple file descriptors, waiting
>>   until one or more of the file descriptors become "ready" for some class of
>>   I/O operation (e.g., input possible). A file descriptor is considered
>>   ready if it is  possible to perform a corresponding I/O operation
>>   (e.g., read(2), or a sufficiently small write(2)) without blocking."
>>
>> I suggest to add the following line:
>>
>> "However, note that select(2) will block on the read end of a pipe/fifo, if
>>   the write end of the pipe/fifo has never been opened before, unlike read(2)
>>   (read(2) will always return with zero if the write end of the pipe/fifo is
>>   closed - see pipe(7) where the text starts with I/O on pipes and fifos).
>
> It is interesting.  Could you please share a small example program
> that demonstrates this behavior?  That would certainly help a lot
> reviewing the change.

Hi Alex,

As a starter I will send you a copy of the message that I sent to Michael some
time ago (He did not respond - he must be too busy).

As I wrote to M., I verified the findings by Ken Brown on Linux (Fedora 35).

Ken Brown's (www.cygwin.com) implementation of select(2) was based on what he
learned from the man pages (and M.K.'s LPI).

Ken was very surprised when he learned about select's behaviour when the write
end of the pipe had not been opened before (and so was I).

Ken corrected his implementation of select(2) and (of course) provided a test
program in order to verify his correction.

You will find that test program in the thread that is mentioned in my message
to M.

Regards,
Henri

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