- We no longer include POLLERR and POLLHUP in the set of requested
events. The standard (SUSv2) says they will be delivered regardless
of the event mask chosen.
- POLLERR is an output event, so we call only the write handler.
- POLLHUP is documented as an output event, but it sometimes signals
events which we would like to process by the input handler. The
situations when POLLHUP is generated include:
* on reading end of a pipe when the writing end has been closed
-> we would like to call read handler and get EOF (write handler
does not exist)
* on writing end of a pipe when the reading end has been closed
-> we would like to call write handler (read handler does not
exist)
* on a R/W socket when the other end has been closed -> better
call read handler to get an EOF
* on a tty which has been hanged up -> probably the same as a R/W
socket
We have therefore decided to call the read handler, but fall back to
the write handler if the read handler does not exist.
- When a handler decided to remove itself (but keep the main_file),
we could have entered an infinite loop. This no longer happens.