summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2020-06-11 09:06:30 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2020-06-11 09:06:30 +0000
commitd79c538e70162087ab4c639328ca213db58e69ac (patch)
tree7e91e603b7e424d1a4704331980046beebe8d423
parentbf15af56f943081b4f6cf66a60f8f0fef2fab337 (diff)
Make spec_kqfilter() and cttykqfilter() behave like their corresponding
poll handler if the EV_OLDAPI flag is set. ok visa@
-rw-r--r--sys/kern/spec_vnops.c17
-rw-r--r--sys/kern/tty_tty.c7
2 files changed, 16 insertions, 8 deletions
diff --git a/sys/kern/spec_vnops.c b/sys/kern/spec_vnops.c
index 887a7acb641..03b866c8a43 100644
--- a/sys/kern/spec_vnops.c
+++ b/sys/kern/spec_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spec_vnops.c,v 1.100 2020/01/20 23:21:55 claudio Exp $ */
+/* $OpenBSD: spec_vnops.c,v 1.101 2020/06/11 09:06:29 mpi Exp $ */
/* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */
/*
@@ -386,11 +386,9 @@ spec_poll(void *v)
dev_t dev;
switch (ap->a_vp->v_type) {
-
default:
return (ap->a_events &
(POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
-
case VCHR:
dev = ap->a_vp->v_rdev;
return (*cdevsw[major(dev)].d_poll)(dev, ap->a_events, ap->a_p);
@@ -400,12 +398,19 @@ int
spec_kqfilter(void *v)
{
struct vop_kqfilter_args *ap = v;
-
dev_t dev;
dev = ap->a_vp->v_rdev;
- if (cdevsw[major(dev)].d_kqfilter)
- return (*cdevsw[major(dev)].d_kqfilter)(dev, ap->a_kn);
+
+ switch (ap->a_vp->v_type) {
+ default:
+ if (ap->a_kn->kn_flags & EV_OLDAPI)
+ return seltrue_kqfilter(dev, ap->a_kn);
+ break;
+ case VCHR:
+ if (cdevsw[major(dev)].d_kqfilter)
+ return (*cdevsw[major(dev)].d_kqfilter)(dev, ap->a_kn);
+ }
return (EOPNOTSUPP);
}
diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c
index 2aa99721cfc..8286f3c4df2 100644
--- a/sys/kern/tty_tty.c
+++ b/sys/kern/tty_tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_tty.c,v 1.25 2020/04/08 08:07:51 mpi Exp $ */
+/* $OpenBSD: tty_tty.c,v 1.26 2020/06/11 09:06:29 mpi Exp $ */
/* $NetBSD: tty_tty.c,v 1.13 1996/03/30 22:24:46 christos Exp $ */
/*-
@@ -158,7 +158,10 @@ cttykqfilter(dev_t dev, struct knote *kn)
{
struct vnode *ttyvp = cttyvp(curproc);
- if (ttyvp == NULL)
+ if (ttyvp == NULL) {
+ if (kn->kn_flags & EV_OLDAPI)
+ return (seltrue_kqfilter(dev, kn));
return (ENXIO);
+ }
return (VOP_KQFILTER(ttyvp, FREAD|FWRITE, kn));
}