All of lore.kernel.org
 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:04:34 +0100	[thread overview]
Message-ID: <6e1260c8-559a-45a8-8f38-6244452c93ed@gmail.com> (raw)
In-Reply-To: <3b5d04cf-8fd7-18f3-9ec3-e23dd3511288@gmail.com>


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

-------- Forwarded Message --------
Subject: Simple changes to select(2) and pipe(7)
Date: Sun, 6 Nov 2022 19:53:35 +0100
From: J.H. vd Water <henri.van.de.water@xs4all.nl>
To: mtk.manpages@gmail.com
CC: alx.manpages@gmail.com

Hi,

I am following the instructions from here:

  - https://www.kernel.org/doc/man-pages/reporting_bugs.html

"Simple one-line or two-line errors ... can be reported by sending an email
  message to the maintainers ..."

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

---
man 7 pipe ... where the paragraph start with "I/O on pipes and FIFOs":

"If a process attempts to read from an empty pipe, then read(2) will block
  until data is available."

I suggest to change the above line as follows:

"If a process attempts to read from an empty pipe while the write end is open,
  then read(2) will block (in case the O_NONBLOCK openfile status flag has been
  disabled) until data is available; however, if the write end of the pipe is
  closed and the pipe is empty, then read(2) will return with zero."

Regards,
Henri

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

  reply	other threads:[~2022-11-09 14:04 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 [this message]
2022-11-09 14:15   ` Alejandro Colomar
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=6e1260c8-559a-45a8-8f38-6244452c93ed@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.