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: 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@xxxxxxxxx>
To: mtk.manpages@xxxxxxxxx
CC: alx.manpages@xxxxxxxxx

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