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) -- the message I sent to M.K. some time ago.
Date: Tue, 8 Nov 2022 15:58:27 +0100
From: J.H. vd Water <henri.van.de.water@xxxxxxxxx>
To: Alejandro Colomar <alx.manpages@xxxxxxxxx>
CC: mtk.manpages@xxxxxxxxx

Alex,

Below the message that I sent to M.K. some time ago; the following subject was used:

"LPI 63.2.3 (when is a file descriptor ready?) /Just a note (for the errata?)"

This message shows 2 things:

 1. it was not me that found the man pages (and LPI) lacking ...
2. after some effort by me, I decided that Ken's claim was correct and that the man
    pages ( select(2) and pipe(7) ) needed to be improved ...

Regards,
Henri

-------- Forwarded Message --------
Subject: LPI 63.2.3 (when is a file descriptor ready?) /Just a note (for the errata?)
Date: Thu, 29 Sep 2022 14:31:45 +0200
From: J.H. vd Water <henri.van.de.water@xxxxxxxxx>
To: mtk@xxxxxxxx

Dear Mr. Kerrisk, Michael

I decide to drop you a note about LPI/ select() ...

 - https://cygwin.com/pipermail/cygwin/2022-September/252246.html

   (Re: FIFO issues - response by Ken Brown in which he announces
    the correction of his implementation of select() - in Cygwin)

Recently I have been reading (and rereading)

 - LPI ch44 (Pipes and FIFOs)
   especially ch44.7 (FIFOs), ch44.9 (Non blocking I/O) and
   ch44.9 (Semantics of read() and write() on pipes and FIFOs)

 - LPI ch63 (alternative I/O methods)
   especially ch63.2 (I/O Multiplexing), ch63.2.1 (The select()
   system call and ch63.2.3 (When is a file descriptor ready?)

and the associated manual pages ...

(and wrote code that confirms that a note should be included with
 the "official documentation")

Why? Because of the problem that was reported against Ken Brown's
implementation of select() (Cygwin).

---
From LPI ch63.2.3 (When is a file descriptor ready?) and from the
manual pages, I got the "impression" (and so did Ken Brown), that

    the read end of a FIFO is "read ready" when the write end of
    the FIFO is (still) closed.

However that turned to be true ONLY AFTER the FIFO has been opened
and closed once ...

True where? It turned to be true for Linux and the "other Unixes".

Any proof you may ask?

Ken Brown implemented select() (Cygwin) according to the "official
documentation".

The thread (see the above URL) makes it clear, that Linux and the
"other Unixes" behave different (how? see above) from Ken Brown's
implementation of select().

Ken B. modified his implementation of select() (see URL). The URL
includes the test program he used to verify his modification.

Bottom-line: the official documentation (LPI, manual pages) should
include a note:

    the read end of a FIFO is NOT "read ready" when the write end
    of the FIFO has never been opened (still closed)
    (when the write end has been opened and closed once, then the
     read end will be "read ready" from then on)

With kind regards,

Henri (J.H. vd Water)

-----

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