Let poll(2) register EVFILT_EXCEPT filter with dead vnodes
authorvisa <visa@openbsd.org>
Mon, 20 Dec 2021 16:22:24 +0000 (16:22 +0000)
committervisa <visa@openbsd.org>
Mon, 20 Dec 2021 16:22:24 +0000 (16:22 +0000)
This enables the system deliver POLLHUP when pollfd.events == 0.

sys/miscfs/deadfs/dead_vnops.c

index c36111f..3459569 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: dead_vnops.c,v 1.39 2021/12/12 09:14:59 visa Exp $    */
+/*     $OpenBSD: dead_vnops.c,v 1.40 2021/12/20 16:22:24 visa Exp $    */
 /*     $NetBSD: dead_vnops.c,v 1.16 1996/02/13 13:12:48 mycroft Exp $  */
 
 /*
@@ -180,6 +180,11 @@ dead_kqfilter(void *v)
        case EVFILT_WRITE:
                ap->a_kn->kn_fop = &dead_filtops;
                break;
+       case EVFILT_EXCEPT:
+               if ((ap->a_kn->kn_flags & __EV_POLL) == 0)
+                       return (EINVAL);
+               ap->a_kn->kn_fop = &dead_filtops;
+               break;
        default:
                return (EINVAL);
        }