Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Oct 2014 09:06:36 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r273461 - stable/10/sys/fs/deadfs
Message-ID:  <201410220906.s9M96aS7034387@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Oct 22 09:06:36 2014
New Revision: 273461
URL: https://svnweb.freebsd.org/changeset/base/273461

Log:
  MFC r273130:
  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().

Modified:
  stable/10/sys/fs/deadfs/dead_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/deadfs/dead_vnops.c
==============================================================================
--- stable/10/sys/fs/deadfs/dead_vnops.c	Wed Oct 22 09:04:56 2014	(r273460)
+++ stable/10/sys/fs/deadfs/dead_vnops.c	Wed Oct 22 09:06:36 2014	(r273461)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410220906.s9M96aS7034387>