From: visa Date: Sat, 11 Dec 2021 09:28:26 +0000 (+0000) Subject: Clarify usage of __EV_POLL and __EV_SELECT X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6ecc0d7f4d6f1d21d2132d485e949a2b82536051;p=openbsd Clarify usage of __EV_POLL and __EV_SELECT Make __EV_POLL specific to kqueue-based poll(2), to remove overlap with __EV_SELECT that only select(2) uses. OK millert@ mpi@ --- diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index ed1b5f39c71..20efc932833 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_vnops.c,v 1.90 2021/10/02 08:51:41 semarie Exp $ */ +/* $OpenBSD: cd9660_vnops.c,v 1.91 2021/12/11 09:28:26 visa Exp $ */ /* $NetBSD: cd9660_vnops.c,v 1.42 1997/10/16 23:56:57 christos Exp $ */ /*- @@ -1017,7 +1017,7 @@ filt_cd9660read(struct knote *kn, long hint) return (1); } - if (kn->kn_flags & __EV_POLL) + if (kn->kn_flags & (__EV_POLL | __EV_SELECT)) return (1); return (kn->kn_data != 0); diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 0cd03a729d1..1a9efde3b52 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.174 2021/11/29 15:54:04 visa Exp $ */ +/* $OpenBSD: kern_event.c,v 1.175 2021/12/11 09:28:26 visa Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon @@ -1779,7 +1779,7 @@ knote_remove(struct proc *p, struct kqueue *kq, struct knlist *list, int purge) * This reuses the original knote for delivering the * notification so as to avoid allocating memory. */ - if (!purge && (kn->kn_flags & __EV_POLL) && + if (!purge && (kn->kn_flags & (__EV_POLL | __EV_SELECT)) && !(p->p_kq == kq && p->p_kq_serial > (unsigned long)kn->kn_udata) && kn->kn_fop != &badfd_filtops) { diff --git a/sys/kern/spec_vnops.c b/sys/kern/spec_vnops.c index 8e0c64c4b12..f66645eaf03 100644 --- a/sys/kern/spec_vnops.c +++ b/sys/kern/spec_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spec_vnops.c,v 1.106 2021/10/15 06:30:06 semarie Exp $ */ +/* $OpenBSD: spec_vnops.c,v 1.107 2021/12/11 09:28:26 visa Exp $ */ /* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */ /* @@ -404,7 +404,7 @@ spec_kqfilter(void *v) switch (ap->a_vp->v_type) { default: - if (ap->a_kn->kn_flags & __EV_POLL) + if (ap->a_kn->kn_flags & (__EV_POLL | __EV_SELECT)) return seltrue_kqfilter(dev, ap->a_kn); break; case VCHR: diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 8fdfb8d8b84..5fd91e03b0a 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_generic.c,v 1.145 2021/12/08 13:03:52 visa Exp $ */ +/* $OpenBSD: sys_generic.c,v 1.146 2021/12/11 09:28:26 visa Exp $ */ /* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */ /* @@ -762,7 +762,7 @@ pselregister(struct proc *p, fd_set *pibits[3], fd_set *pobits[3], int nfd, DPRINTFN(2, "select fd %d mask %d serial %lu\n", fd, msk, p->p_kq_serial); EV_SET(&kev, fd, evf[msk], - EV_ADD|EV_ENABLE|__EV_POLL|__EV_SELECT, + EV_ADD|EV_ENABLE|__EV_SELECT, evff[msk], 0, (void *)(p->p_kq_serial)); #ifdef KTRACE if (KTRPOINT(p, KTR_STRUCT)) diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index acd8b0d33e9..ea658089048 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_tty.c,v 1.28 2021/03/10 10:21:47 jsg Exp $ */ +/* $OpenBSD: tty_tty.c,v 1.29 2021/12/11 09:28:26 visa Exp $ */ /* $NetBSD: tty_tty.c,v 1.13 1996/03/30 22:24:46 christos Exp $ */ /*- @@ -159,7 +159,7 @@ cttykqfilter(dev_t dev, struct knote *kn) struct vnode *ttyvp = cttyvp(curproc); if (ttyvp == NULL) { - if (kn->kn_flags & __EV_POLL) + if (kn->kn_flags & (__EV_POLL | __EV_SELECT)) return (seltrue_kqfilter(dev, kn)); return (ENXIO); } diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index ca8d40f6de0..f40e2957ec3 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo_vnops.c,v 1.86 2021/12/08 13:03:52 visa Exp $ */ +/* $OpenBSD: fifo_vnops.c,v 1.87 2021/12/11 09:28:26 visa Exp $ */ /* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */ /* @@ -531,7 +531,7 @@ fifo_kqfilter(void *v) case EVFILT_WRITE: if (!(ap->a_fflag & FWRITE)) { /* Tell upper layer to ask for POLLUP only */ - if (ap->a_kn->kn_flags & __EV_POLL) + if (ap->a_kn->kn_flags & (__EV_POLL | __EV_SELECT)) return (EPERM); return (EINVAL); } diff --git a/sys/miscfs/fuse/fuse_vnops.c b/sys/miscfs/fuse/fuse_vnops.c index e95ceb6c703..6e2860411c8 100644 --- a/sys/miscfs/fuse/fuse_vnops.c +++ b/sys/miscfs/fuse/fuse_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_vnops.c,v 1.64 2021/10/02 17:29:28 semarie Exp $ */ +/* $OpenBSD: fuse_vnops.c,v 1.65 2021/12/11 09:28:26 visa Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon * @@ -191,7 +191,7 @@ filt_fusefsread(struct knote *kn, long hint) return (1); } - if (kn->kn_flags & __EV_POLL) + if (kn->kn_flags & (__EV_POLL | __EV_SELECT)) return (1); return (kn->kn_data != 0); diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index 142db65b719..1f0571e719b 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vnops.c,v 1.135 2020/12/25 12:59:52 visa Exp $ */ +/* $OpenBSD: msdosfs_vnops.c,v 1.136 2021/12/11 09:28:26 visa Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */ /*- @@ -2014,7 +2014,7 @@ filt_msdosfsread(struct knote *kn, long hint) return (1); } - if (kn->kn_flags & __EV_POLL) + if (kn->kn_flags & (__EV_POLL | __EV_SELECT)) return (1); return (kn->kn_data != 0); diff --git a/sys/nfs/nfs_kq.c b/sys/nfs/nfs_kq.c index fcd826a9889..0d9cfe5b0c1 100644 --- a/sys/nfs/nfs_kq.c +++ b/sys/nfs/nfs_kq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_kq.c,v 1.33 2020/12/25 12:59:53 visa Exp $ */ +/* $OpenBSD: nfs_kq.c,v 1.34 2021/12/11 09:28:26 visa Exp $ */ /* $NetBSD: nfs_kq.c,v 1.7 2003/10/30 01:43:10 simonb Exp $ */ /*- @@ -189,7 +189,7 @@ filt_nfsdetach(struct knote *kn) klist_remove_locked(&vp->v_selectinfo.si_note, kn); /* Remove the vnode from watch list */ - if ((kn->kn_flags & __EV_POLL) == 0) + if ((kn->kn_flags & (__EV_POLL | __EV_SELECT)) == 0) nfs_kqunwatch(vp); } @@ -246,7 +246,7 @@ filt_nfsread(struct knote *kn, long hint) return (1); } - if (kn->kn_flags & __EV_POLL) + if (kn->kn_flags & (__EV_POLL | __EV_SELECT)) return (1); return (kn->kn_data != 0); @@ -335,7 +335,7 @@ nfs_kqfilter(void *v) /* * Put the vnode to watched list. */ - if ((kn->kn_flags & __EV_POLL) == 0) { + if ((kn->kn_flags & (__EV_POLL | __EV_SELECT)) == 0) { int error; error = nfs_kqwatch(vp); diff --git a/sys/sys/event.h b/sys/sys/event.h index 5004978e348..3c30ef21482 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -1,4 +1,4 @@ -/* $OpenBSD: event.h,v 1.60 2021/12/08 13:03:53 visa Exp $ */ +/* $OpenBSD: event.h,v 1.61 2021/12/11 09:28:26 visa Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon @@ -142,7 +142,7 @@ struct klist { /* kernel-only flags */ #define __EV_SELECT 0x0800 /* match behavior of select */ -#define __EV_POLL 0x1000 /* match behavior of poll & select */ +#define __EV_POLL 0x1000 /* match behavior of poll */ #define __EV_HUP EV_FLAG1 /* device or socket disconnected */ #define EVFILT_MARKER 0xf /* placemarker for tailq */ diff --git a/sys/tmpfs/tmpfs_vnops.c b/sys/tmpfs/tmpfs_vnops.c index da574287cd4..5682b4f6345 100644 --- a/sys/tmpfs/tmpfs_vnops.c +++ b/sys/tmpfs/tmpfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmpfs_vnops.c,v 1.50 2021/10/24 16:02:44 patrick Exp $ */ +/* $OpenBSD: tmpfs_vnops.c,v 1.51 2021/12/11 09:28:26 visa Exp $ */ /* $NetBSD: tmpfs_vnops.c,v 1.100 2012/11/05 17:27:39 dholland Exp $ */ /* @@ -2670,7 +2670,7 @@ filt_tmpfsread(struct knote *kn, long hint) return (1); } - if (kn->kn_flags & __EV_POLL) + if (kn->kn_flags & (__EV_POLL | __EV_SELECT)) return (1); return (kn->kn_data != 0); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 0652945fee6..ea6e2649e1d 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vnops.c,v 1.153 2020/12/25 12:59:53 visa Exp $ */ +/* $OpenBSD: ufs_vnops.c,v 1.154 2021/12/11 09:28:26 visa Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */ /* @@ -1973,7 +1973,7 @@ filt_ufsread(struct knote *kn, long hint) return (1); } - if (kn->kn_flags & __EV_POLL) + if (kn->kn_flags & (__EV_POLL | __EV_SELECT)) return (1); return (kn->kn_data != 0);