Linux Manual Pages development
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx.manpages@gmail.com>
To: "J.H. vd Water" <henri.van.de.water@xs4all.nl>,
	linux-man <linux-man@vger.kernel.org>
Cc: Ken Brown <kbrown@cornell.edu>,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	"Michael T. Kerrisk" <mtk@man7.org>
Subject: Re: Fwd: Simple changes to select(2) and pipe(7) - example program
Date: Wed, 9 Nov 2022 15:15:21 +0100	[thread overview]
Message-ID: <0fd276c7-3aab-0075-8a54-1371e4fad925@gmail.com> (raw)
In-Reply-To: <9f23de64-4748-5176-1caa-f05b9f4d5f0f@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 3107 bytes --]

Hi Henri,

On 11/9/22 14:57, Alejandro Colomar wrote:
> -------- Forwarded Message --------
> Subject: Re: Simple changes to select(2) and pipe(7) - example program
> Date: Wed, 9 Nov 2022 09:42:43 +0100
> From: J.H. vd Water <henri.van.de.water@xs4all.nl>
> To: Alejandro Colomar <alx@kernel.org>
> CC: Michael Kerrisk <mtk.manpages@gmail.com>

I've forwarded the emails I got from you to the mailing list, for an open 
discussion.  If I'm missing any, please resend including to the list, and 
preferrably as a reply to this thread.

I've also included Ken in the CC list, as the CONTRIBUTING file recommends, 
since he knows what we're discussing.

I've included both mtk addresses, since this issue is both reported for the man 
pages and for his TLPI book.  But as you've experienced, he's recently been very 
busy and might not respond to this thread.

> 
> 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,
> 
> Yesterday, I replied to Alejandro Colomar <alx.manpages@gmail.com>; I also sent
> you a copy of the message I sent to M.K. on 29th of September (clarification).

Yeah, I see.  For now both my addresses arrive to the same mailbox, so no 
problem there.  Thanks.

The mailing list is more important, though.


> 
> This time I will attach 2 files (i.e. server.c and client.c), the small example
> program that you asked for (using alx@kernel.org as address).

Thanks!

BTW, I just found a bug in the client.c program:

     write(fd, &"What ho!", 9);

That & is wrong.  The address of the array should not be passed to write(2), but 
rather the address to the first element in the array.  This is a mild bug that 
will normally not do any harm, but can be dangerous still, if your compiler is 
optimizing heavily.

I'll take some time to investigate the example programs, since these days I 
don't have much time for that; sorry.  Feel free to ping me in a week or two if 
I didn't respond.

Cheers,

Alex

> 
> Regards,
> Henri

-- 
<http://www.alejandro-colomar.es/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2022-11-09 14:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <30847211-efc7-12be-6ce9-c5c4ada16805@xs4all.nl>
2022-11-09 13:57 ` Fwd: Simple changes to select(2) and pipe(7) - example program Alejandro Colomar
2022-11-09 14:02   ` Alejandro Colomar
2022-11-09 14:04     ` Alejandro Colomar
2022-11-09 14:04       ` Alejandro Colomar
2022-11-09 14:15   ` Alejandro Colomar [this message]
2022-11-09 15:06     ` J.H. vd Water
2022-11-09 15:32       ` J.H. vd Water
2022-11-22 12:22       ` Simple changes to select(2) and pipe(7) J.H. vd Water
2022-11-22 12:25         ` J.H. vd Water
2022-12-01 14:39           ` J.H. vd Water

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0fd276c7-3aab-0075-8a54-1371e4fad925@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=henri.van.de.water@xs4all.nl \
    --cc=kbrown@cornell.edu \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=mtk@man7.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox