svn commit: r273130 - head/sys/fs/deadfs

Bruce Evans brde at optusnet.com.au
Mon Oct 27 17:52:54 UTC 2014


On Wed, 15 Oct 2014, Konstantin Belousov wrote:

> Log:
>  Change the deadfs poll VOP to return POLLIN|POLLRDNORM if the caller
>  is interested in i/o state.  Return POLLNVAL for invalid bits, similar
>  to poll_no_poll().  Note that POLLOUT must not be returned, since
>  POLLHUP is set.
>
>  Noted and reviewed by:	bde
>  Sponsored by:	The FreeBSD Foundation
>  MFC after:	1 week

Thanks.

This is not a complete fix, but is just bug for bug compatible with
poll_no_poll() and less buggy that the previous version.

POLLNVAL means that the fd is valid, so it should not be returned for
dead fd's (the whole point of deadfs is to keep the fd's alive enough
to be valid).  POLLIN should only be returned in there is (non-null)
data.

For some fd's, there may be both hangup and data, but for dead fd's
there can only be hangup, so POLLIN is especially useless for deadfs.
ttys are one of the few file types that usually set POLLIN correctly
for EOF (that is, POLLIN is not set for EOF).  2 unusual broken cases
remain for ttys:
- when the tty goes away but the fd is still connected to the tty driver,
   POLLIN is set if it is checked for
- but the fd is connected to deadfs (typically after it is revoked), the
   behaviour is now the same as when the tty goes away, except POLLNVAL
   is also set.
For other file types, the new behaviour matches bugs in the handling for
undead fd's better, while fixing some of the bugs in the old behaviour.

Bruce


More information about the svn-src-all mailing list