Re: Simple changes to select(2) and pipe(7)

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

 



Hi Alex,

Additional information:

LPI 63.2.3 Comparison of select() and poll():

Implementation details

"Within the Linux kernel, select() and poll() both employ the same set of
 kernel-internal poll routines ..."

See also: https://github.com/torvalds/linux/blob/master/fs/select.c

Furthermore:

 - https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html

DESCRIPTION
...
  POLLHUP
    A device has been disconnected, or a pipe or FIFO has been closed by the last process
    that had it open for writing. ...
...
RATIONALE

  The POLLHUP event does not occur for FIFOs just because the FIFO is not open for writing.
  It only occurs when the FIFO is closed by the last writer and persists until some process
  opens the FIFO for writing or until all read-only file descriptors for the FIFO are closed.

Next I decided to verify this on Linux (Fedora 35): poll(2) returns zero (after time out) on
a FIFO of which the write end is closed from the start ...,

meaning neither POLLIN nor POLLHUP have been set in revents.

Bottom-line: select(2) blocks on a FIFO of which the write end is closed from
the start (i.e. select.2 is wrong, or at least not complete).

Regards,
Henri



[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