On 02/04/20(Thu) 20:25, Mark Kettenis wrote:
> > Date: Thu, 2 Apr 2020 20:12:08 +0200
> > From: Martin Pieuchot <m...@openbsd.org>
> > Content-Type: text/plain; charset=utf-8
> > 
> > While reviewing the all current .d_poll() functions I found those two
> > which are incoherent with the rest.
> > 
> > - Most of the devices return POLLERR when the device is no longer valid,
> >   for whatever reason, uhid(4) returns POLLHUP in one of the cases.
> 
> POSIX says:
> 
> POLLHUP
> 
>   A device has been disconnected, or a pipe or FIFO has been closed by
>   the last process that had it open for writing. Once set, the hangup
>   state of a FIFO shall persist until some process opens the FIFO for
>   writing or until all read-only file descriptors for the FIFO are
>   closed. This event and POLLOUT are mutually-exclusive; a stream can
>   never be writable if a hangup has occurred. However, this event and
>   POLLIN, POLLRDNORM, POLLRDBAND, or POLLPRI are not
>   mutually-exclusive. This flag is only valid in the revents bitmask;
>   it shall be ignored in the events member.
> 
> So POLLHUP makes sense for devices that can be disconnected.

that's one interpretation.  Now looking at the whole picture none of the
other drivers that can be disconnected return POLLHUP.  In fact they
return POLLERR in that case.  Since POLLERR is also valid in this case
and it makes the whole drivers coherent, don't you see the benefit of
this change?

Or are you suggesting we change the other drivers to return POLLHUP in
this case?

Reply via email to