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

Konstantin Belousov kib at FreeBSD.org
Wed Oct 15 13:08:54 UTC 2014


Author: kib
Date: Wed Oct 15 13:08:53 2014
New Revision: 273130
URL: https://svnweb.freebsd.org/changeset/base/273130

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

Modified:
  head/sys/fs/deadfs/dead_vnops.c

Modified: head/sys/fs/deadfs/dead_vnops.c
==============================================================================
--- head/sys/fs/deadfs/dead_vnops.c	Wed Oct 15 12:38:26 2014	(r273129)
+++ head/sys/fs/deadfs/dead_vnops.c	Wed Oct 15 13:08:53 2014	(r273130)
@@ -163,16 +163,19 @@ dead_write(ap)
 	return (EIO);
 }
 
-/*
- * Trivial poll routine that always returns POLLHUP.
- * This is necessary so that a process which is polling a file
- * gets notified when that file is revoke()d.
- */
 static int
 dead_poll(ap)
 	struct vop_poll_args *ap;
 {
-	return (POLLHUP);
+
+	if (ap->a_events & ~POLLSTANDARD)
+		return (POLLNVAL);
+
+	/*
+	 * Let the user find out that the descriptor is gone.
+	 */
+	return (POLLHUP | ((POLLIN | POLLRDNORM) & ap->a_events));
+
 }
 
 static int


More information about the svn-src-head mailing list