svn commit: r208374 - head/sys/kern

Bruce Evans brde at optusnet.com.au
Sun May 23 05:18:57 UTC 2010


On Fri, 21 May 2010, Konstantin Belousov wrote:

> Log:
>  Remove PIOLLHUP from the flags used to test for to set exceptfsd
>  fd_set bits in select(2). It seems that historical behaviour is to not
>  reporting exception on EOF, and several applications are broken.
>
>  Reported by:	Yoshihiko Sarumaru <ysarumaru gmail com>
>  Discussed with:	bde

Er, the discussion pointed out that this change has no effect (except
possibly for bugs).

> Modified: head/sys/kern/sys_generic.c
> ==============================================================================
> --- head/sys/kern/sys_generic.c	Fri May 21 09:52:49 2010	(r208373)
> +++ head/sys/kern/sys_generic.c	Fri May 21 10:36:29 2010	(r208374)
> @@ -996,7 +996,7 @@ done:
> static int select_flags[3] = {
>     POLLRDNORM | POLLHUP | POLLERR,
>     POLLWRNORM | POLLHUP | POLLERR,
> -    POLLRDBAND | POLLHUP | POLLERR
> +    POLLRDBAND | POLLERR
> };
>
> /*
>

POLLHUP and POLLHUP are output-only, so their use as input flags here is
nonsense on all 3 lines.  This nonsense has no effect as far as I can see,
since nonsensical input flags are ignored.  POLLHUP is still set
unconditionally (if hangup actually occurs) for all 3 channels, and this
conflicts with the historical misbehaviour for the exceptfds channel.
POLLHUP can be suppressed by POLLINIGNEOF.  Using POLLINIGNEOF on the
3rd channel onnel seems to work right here, although POLLINIGNEOF's
name indicates that it should not -- as its name suggests, POLLINIGNEOF
was intended to only cause EOF to be ignored for the input channel,
and it may have actually done that, but it now applies to all channels.
This doesn't matter for select() since there is a separate poll at the
lowest level each channel, but for poll() there is normally only 1
poll at the lowest level, and in any case userland cannot influence
the misapplication of POLLINIGNEOF to a non-input event, and anyway^2
poll()'s semantics require it to set POLLHUP even if there the input
mask of events is empty, so poll()'s channels are inseparable for
POLLHUP.

The style bugs (4-char primary indentation) remain.

Bruce


More information about the svn-src-all mailing list