Remove unused device poll functions. This also removes unneeded includes of <sys/poll.h> and <sys/select.h> from the kernel. Some includes of <sys/selinfo.h> are removed as well, but another cleanup will come related to that header.
After this, most of the remnants of the old poll machinery can be removed. OK? Index: arch/macppc/dev/adb.c =================================================================== RCS file: src/sys/arch/macppc/dev/adb.c,v retrieving revision 1.45 diff -u -p -r1.45 adb.c --- arch/macppc/dev/adb.c 13 Mar 2022 12:33:01 -0000 1.45 +++ arch/macppc/dev/adb.c 1 Jul 2022 13:49:09 -0000 @@ -87,8 +87,6 @@ #include <sys/param.h> #include <sys/device.h> #include <sys/fcntl.h> -#include <sys/poll.h> -#include <sys/selinfo.h> #include <sys/proc.h> #include <sys/signalvar.h> #include <sys/timeout.h> Index: arch/macppc/dev/akbd_machdep.c =================================================================== RCS file: src/sys/arch/macppc/dev/akbd_machdep.c,v retrieving revision 1.2 diff -u -p -r1.2 akbd_machdep.c --- arch/macppc/dev/akbd_machdep.c 3 Sep 2019 17:51:52 -0000 1.2 +++ arch/macppc/dev/akbd_machdep.c 1 Jul 2022 13:49:09 -0000 @@ -36,8 +36,6 @@ #include <sys/kernel.h> #include <sys/device.h> #include <sys/fcntl.h> -#include <sys/poll.h> -#include <sys/selinfo.h> #include <sys/proc.h> #include <sys/signalvar.h> #include <sys/systm.h> Index: arch/sparc64/dev/vldcp.c =================================================================== RCS file: src/sys/arch/sparc64/dev/vldcp.c,v retrieving revision 1.22 diff -u -p -r1.22 vldcp.c --- arch/sparc64/dev/vldcp.c 24 Oct 2021 17:05:04 -0000 1.22 +++ arch/sparc64/dev/vldcp.c 1 Jul 2022 13:49:09 -0000 @@ -19,7 +19,6 @@ #include <sys/conf.h> #include <sys/device.h> #include <sys/malloc.h> -#include <sys/poll.h> #include <sys/proc.h> #include <sys/systm.h> @@ -576,49 +575,6 @@ vldcpioctl(dev_t dev, u_long cmd, caddr_ device_unref(&sc->sc_dv); return (0); -} - -int -vldcppoll(dev_t dev, int events, struct proc *p) -{ - struct vldcp_softc *sc; - struct ldc_conn *lc; - uint64_t head, tail, state; - int revents = 0; - int s, err; - - sc = vldcp_lookup(dev); - if (sc == NULL) - return (POLLERR); - lc = &sc->sc_lc; - - s = spltty(); - if (events & (POLLIN | POLLRDNORM)) { - err = hv_ldc_rx_get_state(lc->lc_id, &head, &tail, &state); - - if (err == 0 && state == LDC_CHANNEL_UP && head != tail) - revents |= events & (POLLIN | POLLRDNORM); - } - if (events & (POLLOUT | POLLWRNORM)) { - err = hv_ldc_tx_get_state(lc->lc_id, &head, &tail, &state); - - if (err == 0 && state == LDC_CHANNEL_UP && head != tail) - revents |= events & (POLLOUT | POLLWRNORM); - } - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) { - cbus_intr_setenabled(sc->sc_bustag, sc->sc_rx_ino, - INTR_ENABLED); - selrecord(p, &sc->sc_rsel); - } - if (events & (POLLOUT | POLLWRNORM)) { - cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, - INTR_ENABLED); - selrecord(p, &sc->sc_wsel); - } - } - splx(s); - return revents; } void Index: dev/audio.c =================================================================== RCS file: src/sys/dev/audio.c,v retrieving revision 1.198 diff -u -p -r1.198 audio.c --- dev/audio.c 21 Mar 2022 19:22:39 -0000 1.198 +++ dev/audio.c 1 Jul 2022 13:49:09 -0000 @@ -19,7 +19,6 @@ #include <sys/systm.h> #include <sys/ioctl.h> #include <sys/conf.h> -#include <sys/poll.h> #include <sys/kernel.h> #include <sys/task.h> #include <sys/vnode.h> @@ -2051,22 +2050,6 @@ audio_mixer_read(struct audio_softc *sc, } int -audio_mixer_poll(struct audio_softc *sc, int events, struct proc *p) -{ - int revents = 0; - - mtx_enter(&audio_lock); - if (sc->mix_isopen && sc->mix_pending) - revents |= events & (POLLIN | POLLRDNORM); - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &sc->mix_sel); - } - mtx_leave(&audio_lock); - return revents; -} - -int audio_mixer_open(struct audio_softc *sc, int flags) { DPRINTF("%s: flags = 0x%x\n", __func__, flags); @@ -2099,26 +2082,6 @@ audio_mixer_close(struct audio_softc *sc } int -audio_poll(struct audio_softc *sc, int events, struct proc *p) -{ - int revents = 0; - - mtx_enter(&audio_lock); - if ((sc->mode & AUMODE_RECORD) && sc->rec.used > 0) - revents |= events & (POLLIN | POLLRDNORM); - if ((sc->mode & AUMODE_PLAY) && sc->play.used < sc->play.len) - revents |= events & (POLLOUT | POLLWRNORM); - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &sc->rec.sel); - if (events & (POLLOUT | POLLWRNORM)) - selrecord(p, &sc->play.sel); - } - mtx_leave(&audio_lock); - return revents; -} - -int audioopen(dev_t dev, int flags, int mode, struct proc *p) { struct audio_softc *sc; @@ -2248,30 +2211,6 @@ audioioctl(dev_t dev, u_long cmd, caddr_ } device_unref(&sc->dev); return error; -} - -int -audiopoll(dev_t dev, int events, struct proc *p) -{ - struct audio_softc *sc; - int revents; - - sc = (struct audio_softc *)device_lookup(&audio_cd, AUDIO_UNIT(dev)); - if (sc == NULL) - return POLLERR; - switch (AUDIO_DEV(dev)) { - case AUDIO_DEV_AUDIO: - revents = audio_poll(sc, events, p); - break; - case AUDIO_DEV_AUDIOCTL: - revents = audio_mixer_poll(sc, events, p); - break; - default: - revents = 0; - break; - } - device_unref(&sc->dev); - return revents; } int Index: dev/cons.c =================================================================== RCS file: src/sys/dev/cons.c,v retrieving revision 1.29 diff -u -p -r1.29 cons.c --- dev/cons.c 3 Apr 2020 08:24:52 -0000 1.29 +++ dev/cons.c 1 Jul 2022 13:49:09 -0000 @@ -45,7 +45,6 @@ #include <sys/tty.h> #include <sys/conf.h> #include <sys/vnode.h> -#include <sys/poll.h> #include <dev/cons.h> @@ -178,26 +177,6 @@ cnioctl(dev_t dev, u_long cmd, caddr_t d dev = cn_tab->cn_dev; return ((*cdevsw[major(dev)].d_ioctl)(dev, cmd, data, flag, p)); } - -/*ARGSUSED*/ -int -cnpoll(dev_t dev, int rw, struct proc *p) -{ - - /* - * Redirect the poll, if that's appropriate. - * I don't want to think of the possible side effects - * of console redirection here. - */ - if (constty != NULL) - dev = constty->t_dev; - else if (cn_tab == NULL) - return POLLERR; - else - dev = cn_tab->cn_dev; - return (ttpoll(dev, rw, p)); -} - int cnkqfilter(dev_t dev, struct knote *kn) Index: dev/cons.h =================================================================== RCS file: src/sys/dev/cons.h,v retrieving revision 1.18 diff -u -p -r1.18 cons.h --- dev/cons.h 17 May 2016 23:43:47 -0000 1.18 +++ dev/cons.h 1 Jul 2022 13:49:09 -0000 @@ -81,7 +81,6 @@ int cnclose(dev_t, int, int, struct proc int cnread(dev_t, struct uio *, int); int cnwrite(dev_t, struct uio *, int); int cnioctl(dev_t, u_long, caddr_t, int, struct proc *); -int cnpoll(dev_t, int, struct proc *); int cnkqfilter(dev_t, struct knote *); int cngetc(void); void cnputc(int); Index: dev/hotplug.c =================================================================== RCS file: src/sys/dev/hotplug.c,v retrieving revision 1.21 diff -u -p -r1.21 hotplug.c --- dev/hotplug.c 25 Dec 2020 12:59:52 -0000 1.21 +++ dev/hotplug.c 1 Jul 2022 13:49:09 -0000 @@ -25,7 +25,6 @@ #include <sys/fcntl.h> #include <sys/hotplug.h> #include <sys/ioctl.h> -#include <sys/poll.h> #include <sys/vnode.h> #define HOTPLUG_MAXEVENTS 64 @@ -178,21 +177,6 @@ hotplugioctl(dev_t dev, u_long cmd, cadd } return (0); -} - -int -hotplugpoll(dev_t dev, int events, struct proc *p) -{ - int revents = 0; - - if (events & (POLLIN | POLLRDNORM)) { - if (evqueue_count > 0) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &hotplug_sel); - } - - return (revents); } int Index: dev/midi.c =================================================================== RCS file: src/sys/dev/midi.c,v retrieving revision 1.54 diff -u -p -r1.54 midi.c --- dev/midi.c 6 Apr 2022 18:59:27 -0000 1.54 +++ dev/midi.c 1 Jul 2022 13:49:09 -0000 @@ -21,7 +21,6 @@ #include <sys/systm.h> #include <sys/ioctl.h> #include <sys/conf.h> -#include <sys/poll.h> #include <sys/kernel.h> #include <sys/timeout.h> #include <sys/vnode.h> @@ -39,7 +38,6 @@ int midiopen(dev_t, int, int, struct pro int midiclose(dev_t, int, int, struct proc *); int midiread(dev_t, struct uio *, int); int midiwrite(dev_t, struct uio *, int); -int midipoll(dev_t, int, struct proc *); int midikqfilter(dev_t, struct knote *); int midiioctl(dev_t, u_long, caddr_t, int, struct proc *); int midiprobe(struct device *, void *, void *); @@ -329,36 +327,6 @@ done_mtx: done: device_unref(&sc->dev); return error; -} - -int -midipoll(dev_t dev, int events, struct proc *p) -{ - struct midi_softc *sc; - int revents; - - sc = (struct midi_softc *)device_lookup(&midi_cd, minor(dev)); - if (sc == NULL) - return POLLERR; - revents = 0; - mtx_enter(&audio_lock); - if (events & (POLLIN | POLLRDNORM)) { - if (!MIDIBUF_ISEMPTY(&sc->inbuf)) - revents |= events & (POLLIN | POLLRDNORM); - } - if (events & (POLLOUT | POLLWRNORM)) { - if (!MIDIBUF_ISFULL(&sc->outbuf)) - revents |= events & (POLLOUT | POLLWRNORM); - } - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &sc->inbuf.sel); - if (events & (POLLOUT | POLLWRNORM)) - selrecord(p, &sc->outbuf.sel); - } - mtx_leave(&audio_lock); - device_unref(&sc->dev); - return (revents); } int Index: dev/video.c =================================================================== RCS file: src/sys/dev/video.c,v retrieving revision 1.56 diff -u -p -r1.56 video.c --- dev/video.c 6 Apr 2022 18:59:27 -0000 1.56 +++ dev/video.c 1 Jul 2022 13:49:09 -0000 @@ -22,7 +22,6 @@ #include <sys/errno.h> #include <sys/ioctl.h> #include <sys/fcntl.h> -#include <sys/poll.h> #include <sys/device.h> #include <sys/vnode.h> #include <sys/kernel.h> @@ -388,54 +387,6 @@ videoioctl(dev_t dev, u_long cmd, caddr_ } return (error); -} - -int -videopoll(dev_t dev, int events, struct proc *p) -{ - int unit = VIDEOUNIT(dev); - struct video_softc *sc; - int error, revents = 0; - - KERNEL_ASSERT_LOCKED(); - - if (unit >= video_cd.cd_ndevs || - (sc = video_cd.cd_devs[unit]) == NULL) - return (POLLERR); - - if (sc->sc_dying) - return (POLLERR); - - if ((error = video_claim(sc, p->p_p))) - return (error); - - DPRINTF(1, "%s: events=0x%x\n", __func__, events); - - if (events & (POLLIN | POLLRDNORM)) { - if (sc->sc_frames_ready > 0) - revents |= events & (POLLIN | POLLRDNORM); - } - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) { - /* - * Start the stream in read() mode if not already - * started. If the user wanted mmap() mode, - * he should have called mmap() before now. - */ - if (sc->sc_vidmode == VIDMODE_NONE && - sc->hw_if->start_read) { - error = sc->hw_if->start_read(sc->hw_hdl); - if (error) - return (POLLERR); - sc->sc_vidmode = VIDMODE_READ; - } - selrecord(p, &sc->sc_rsel); - } - } - - DPRINTF(1, "%s: revents=0x%x\n", __func__, revents); - - return (revents); } paddr_t Index: dev/vscsi.c =================================================================== RCS file: src/sys/dev/vscsi.c,v retrieving revision 1.60 diff -u -p -r1.60 vscsi.c --- dev/vscsi.c 16 Apr 2022 19:19:58 -0000 1.60 +++ dev/vscsi.c 1 Jul 2022 13:49:09 -0000 @@ -27,7 +27,6 @@ #include <sys/pool.h> #include <sys/task.h> #include <sys/ioctl.h> -#include <sys/poll.h> #include <sys/selinfo.h> #include <scsi/scsi_all.h> @@ -525,31 +524,6 @@ gone: device_unref(&sc->sc_dev); free(dt, M_TEMP, sizeof(*dt)); -} - -int -vscsipoll(dev_t dev, int events, struct proc *p) -{ - struct vscsi_softc *sc = DEV2SC(dev); - int revents = 0; - - if (sc == NULL) - return (POLLERR); - - if (events & (POLLIN | POLLRDNORM)) { - mtx_enter(&sc->sc_state_mtx); - if (!TAILQ_EMPTY(&sc->sc_ccb_i2t)) - revents |= events & (POLLIN | POLLRDNORM); - mtx_leave(&sc->sc_state_mtx); - } - - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &sc->sc_sel); - } - - device_unref(&sc->sc_dev); - return (revents); } int Index: dev/fdt/exuart.c =================================================================== RCS file: src/sys/dev/fdt/exuart.c,v retrieving revision 1.10 diff -u -p -r1.10 exuart.c --- dev/fdt/exuart.c 6 Apr 2022 18:59:28 -0000 1.10 +++ dev/fdt/exuart.c 1 Jul 2022 13:49:09 -0000 @@ -26,7 +26,6 @@ #include <sys/syslog.h> #include <sys/conf.h> #include <sys/fcntl.h> -#include <sys/select.h> #include <sys/kernel.h> #include <machine/bus.h> Index: dev/fdt/imxuart.c =================================================================== RCS file: src/sys/dev/fdt/imxuart.c,v retrieving revision 1.12 diff -u -p -r1.12 imxuart.c --- dev/fdt/imxuart.c 24 Oct 2021 17:52:26 -0000 1.12 +++ dev/fdt/imxuart.c 1 Jul 2022 13:49:09 -0000 @@ -26,7 +26,6 @@ #include <sys/syslog.h> #include <sys/conf.h> #include <sys/fcntl.h> -#include <sys/select.h> #include <sys/kernel.h> #include <machine/bus.h> Index: dev/gpio/gpiodcf.c =================================================================== RCS file: src/sys/dev/gpio/gpiodcf.c,v retrieving revision 1.9 diff -u -p -r1.9 gpiodcf.c --- dev/gpio/gpiodcf.c 24 Jun 2020 22:03:41 -0000 1.9 +++ dev/gpio/gpiodcf.c 1 Jul 2022 13:49:09 -0000 @@ -20,11 +20,9 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/conf.h> -#include <sys/select.h> #include <sys/proc.h> #include <sys/vnode.h> #include <sys/device.h> -#include <sys/poll.h> #include <sys/time.h> #include <sys/sensors.h> #include <sys/gpio.h> Index: dev/ic/pluart.c =================================================================== RCS file: src/sys/dev/ic/pluart.c,v retrieving revision 1.13 diff -u -p -r1.13 pluart.c --- dev/ic/pluart.c 28 Jun 2022 16:28:08 -0000 1.13 +++ dev/ic/pluart.c 1 Jul 2022 13:49:09 -0000 @@ -27,7 +27,6 @@ #include <sys/syslog.h> #include <sys/conf.h> #include <sys/fcntl.h> -#include <sys/select.h> #include <sys/kernel.h> #include <machine/bus.h> Index: dev/pci/bktr/bktr_os.c =================================================================== RCS file: src/sys/dev/pci/bktr/bktr_os.c,v retrieving revision 1.36 diff -u -p -r1.36 bktr_os.c --- dev/pci/bktr/bktr_os.c 21 Mar 2022 19:22:41 -0000 1.36 +++ dev/pci/bktr/bktr_os.c 1 Jul 2022 13:49:09 -0000 @@ -60,8 +60,6 @@ #include <sys/kernel.h> #include <sys/signalvar.h> #include <sys/mman.h> -#include <sys/poll.h> -#include <sys/selinfo.h> #include <sys/vnode.h> #if NRADIO > 0 #include <sys/radioio.h> Index: dev/pci/drm/drm_drv.c =================================================================== RCS file: src/sys/dev/pci/drm/drm_drv.c,v retrieving revision 1.184 diff -u -p -r1.184 drm_drv.c --- dev/pci/drm/drm_drv.c 11 Mar 2022 18:00:53 -0000 1.184 +++ dev/pci/drm/drm_drv.c 1 Jul 2022 13:49:09 -0000 @@ -28,7 +28,6 @@ #include <sys/param.h> #include <sys/fcntl.h> -#include <sys/poll.h> #include <sys/specdev.h> #include <sys/vnode.h> @@ -1862,34 +1861,6 @@ out: mtx_leave(&dev->event_lock); return (gotone); -} - -int -drmpoll(dev_t kdev, int events, struct proc *p) -{ - struct drm_device *dev = drm_get_device_from_kdev(kdev); - struct drm_file *file_priv; - int revents = 0; - - if (dev == NULL) - return (POLLERR); - - mutex_lock(&dev->filelist_mutex); - file_priv = drm_find_file_by_minor(dev, minor(kdev)); - mutex_unlock(&dev->filelist_mutex); - if (file_priv == NULL) - return (POLLERR); - - mtx_enter(&dev->event_lock); - if (events & (POLLIN | POLLRDNORM)) { - if (!list_empty(&file_priv->event_list)) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &file_priv->rsel); - } - mtx_leave(&dev->event_lock); - - return (revents); } paddr_t Index: dev/sbus/magma.c =================================================================== RCS file: src/sys/dev/sbus/magma.c,v retrieving revision 1.34 diff -u -p -r1.34 magma.c --- dev/sbus/magma.c 13 Mar 2022 13:34:54 -0000 1.34 +++ dev/sbus/magma.c 1 Jul 2022 13:49:10 -0000 @@ -1340,7 +1340,6 @@ mtty_param(struct tty *tp, struct termio * mbppread read from mbpp * mbppwrite write to mbpp * mbppioctl do ioctl on mbpp - * mbpppoll do poll on mbpp * mbppkqfilter kqueue on mbpp * mbpp_rw general rw routine * mbpp_timeout rw timeout @@ -1506,15 +1505,6 @@ mbppioctl(dev_t dev, u_long cmd, caddr_t } return (error); -} - -/* - * poll routine - */ -int -mbpppoll(dev_t dev, int events, struct proc *p) -{ - return (seltrue(dev, events, p)); } int Index: dev/sbus/spif.c =================================================================== RCS file: src/sys/dev/sbus/spif.c,v retrieving revision 1.26 diff -u -p -r1.26 spif.c --- dev/sbus/spif.c 13 Mar 2022 13:34:54 -0000 1.26 +++ dev/sbus/spif.c 1 Jul 2022 13:49:10 -0000 @@ -90,7 +90,6 @@ int sbppread(dev_t, struct uio *, int); int sbppwrite(dev_t, struct uio *, int); int sbpp_rw(dev_t, struct uio *); int spifppcintr(void *); -int sbpppoll(dev_t, int, struct proc *); int sbppkqfilter(dev_t, struct knote *); int sbppioctl(dev_t, u_long, caddr_t, int, struct proc *); @@ -1040,11 +1039,6 @@ sbpp_rw(dev_t dev, struct uio *uio) return (ENXIO); } -int -sbpppoll(dev_t dev, int events, struct proc *p) -{ - return (seltrue(dev, events, p)); -} int sbppkqfilter(dev_t dev, struct knote *kn) { Index: dev/usb/fido.c =================================================================== RCS file: src/sys/dev/usb/fido.c,v retrieving revision 1.4 diff -u -p -r1.4 fido.c --- dev/usb/fido.c 15 Nov 2021 15:36:24 -0000 1.4 +++ dev/usb/fido.c 1 Jul 2022 13:49:10 -0000 @@ -27,10 +27,8 @@ #include <sys/ioctl.h> #include <sys/conf.h> #include <sys/tty.h> -#include <sys/selinfo.h> #include <sys/proc.h> #include <sys/vnode.h> -#include <sys/poll.h> #include <dev/usb/usb.h> #include <dev/usb/usbhid.h> Index: dev/usb/ubsa.c =================================================================== RCS file: src/sys/dev/usb/ubsa.c,v retrieving revision 1.68 diff -u -p -r1.68 ubsa.c --- dev/usb/ubsa.c 9 Apr 2022 20:07:44 -0000 1.68 +++ dev/usb/ubsa.c 1 Jul 2022 13:49:10 -0000 @@ -63,8 +63,6 @@ #include <sys/fcntl.h> #include <sys/conf.h> #include <sys/tty.h> -#include <sys/selinfo.h> -#include <sys/poll.h> #include <dev/usb/usb.h> #include <dev/usb/usbcdc.h> Index: dev/usb/ucom.c =================================================================== RCS file: src/sys/dev/usb/ucom.c,v retrieving revision 1.73 diff -u -p -r1.73 ucom.c --- dev/usb/ucom.c 27 Jun 2022 13:14:49 -0000 1.73 +++ dev/usb/ucom.c 1 Jul 2022 13:49:10 -0000 @@ -42,10 +42,8 @@ #include <sys/conf.h> #include <sys/tty.h> #include <sys/fcntl.h> -#include <sys/selinfo.h> #include <sys/vnode.h> #include <sys/device.h> -#include <sys/poll.h> #include <dev/usb/usb.h> Index: dev/usb/udcf.c =================================================================== RCS file: src/sys/dev/usb/udcf.c,v retrieving revision 1.64 diff -u -p -r1.64 udcf.c --- dev/usb/udcf.c 24 Jun 2020 22:03:41 -0000 1.64 +++ dev/usb/udcf.c 1 Jul 2022 13:49:10 -0000 @@ -19,9 +19,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> -#include <sys/select.h> #include <sys/device.h> -#include <sys/poll.h> #include <sys/time.h> #include <sys/sensors.h> #include <sys/timeout.h> Index: dev/usb/ugen.c =================================================================== RCS file: src/sys/dev/usb/ugen.c,v retrieving revision 1.115 diff -u -p -r1.115 ugen.c --- dev/usb/ugen.c 5 Feb 2021 08:17:22 -0000 1.115 +++ dev/usb/ugen.c 1 Jul 2022 13:49:10 -0000 @@ -44,7 +44,6 @@ #include <sys/fcntl.h> #include <sys/selinfo.h> #include <sys/vnode.h> -#include <sys/poll.h> #include <machine/bus.h> @@ -1243,67 +1242,6 @@ ugenioctl(dev_t dev, u_long cmd, caddr_t if (--sc->sc_refcnt < 0) usb_detach_wakeup(&sc->sc_dev); return (error); -} - -int -ugenpoll(dev_t dev, int events, struct proc *p) -{ - struct ugen_softc *sc; - struct ugen_endpoint *sce; - int revents = 0; - int s; - - sc = ugen_cd.cd_devs[UGENUNIT(dev)]; - - if (usbd_is_dying(sc->sc_udev)) - return (POLLERR); - - /* XXX always IN */ - sce = &sc->sc_endpoints[UGENENDPOINT(dev)][IN]; - if (sce == NULL) - return (POLLERR); -#ifdef DIAGNOSTIC - if (!sce->edesc) { - printf("ugenpoll: no edesc\n"); - return (POLLERR); - } - if (!sce->pipeh) { - printf("ugenpoll: no pipe\n"); - return (POLLERR); - } -#endif - s = splusb(); - switch (UE_GET_XFERTYPE(sce->edesc->bmAttributes)) { - case UE_INTERRUPT: - if (events & (POLLIN | POLLRDNORM)) { - if (sce->q.c_cc > 0) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &sce->rsel); - } - break; - case UE_ISOCHRONOUS: - if (events & (POLLIN | POLLRDNORM)) { - if (sce->cur != sce->fill) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &sce->rsel); - } - break; - case UE_BULK: - /* - * We have no easy way of determining if a read will - * yield any data or a write will happen. - * Pretend they will. - */ - revents |= events & - (POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM); - break; - default: - break; - } - splx(s); - return (revents); } void filt_ugenrdetach(struct knote *); Index: dev/usb/uhid.c =================================================================== RCS file: src/sys/dev/usb/uhid.c,v retrieving revision 1.88 diff -u -p -r1.88 uhid.c --- dev/usb/uhid.c 15 Nov 2021 15:36:24 -0000 1.88 +++ dev/usb/uhid.c 1 Jul 2022 13:49:10 -0000 @@ -50,7 +50,6 @@ #include <sys/selinfo.h> #include <sys/proc.h> #include <sys/vnode.h> -#include <sys/poll.h> #include <dev/usb/usb.h> #include <dev/usb/usbhid.h> @@ -412,33 +411,6 @@ uhidioctl(dev_t dev, u_long cmd, caddr_t if (--sc->sc_refcnt < 0) usb_detach_wakeup(&sc->sc_hdev.sc_dev); return (error); -} - -int -uhidpoll(dev_t dev, int events, struct proc *p) -{ - struct uhid_softc *sc; - int revents = 0; - int s; - - if ((sc = uhid_lookup(dev)) == NULL) - return (POLLERR); - - if (usbd_is_dying(sc->sc_hdev.sc_udev)) - return (POLLHUP); - - s = splusb(); - if (events & (POLLOUT | POLLWRNORM)) - revents |= events & (POLLOUT | POLLWRNORM); - if (events & (POLLIN | POLLRDNORM)) { - if (sc->sc_q.c_cc > 0) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &sc->sc_rsel); - } - - splx(s); - return (revents); } void filt_uhidrdetach(struct knote *); Index: dev/usb/ujoy.c =================================================================== RCS file: src/sys/dev/usb/ujoy.c,v retrieving revision 1.3 diff -u -p -r1.3 ujoy.c --- dev/usb/ujoy.c 15 Nov 2021 15:36:24 -0000 1.3 +++ dev/usb/ujoy.c 1 Jul 2022 13:49:10 -0000 @@ -26,10 +26,8 @@ #include <sys/ioctl.h> #include <sys/conf.h> #include <sys/tty.h> -#include <sys/selinfo.h> #include <sys/proc.h> #include <sys/vnode.h> -#include <sys/poll.h> #include <sys/fcntl.h> #include <dev/usb/usb.h> Index: dev/usb/umbg.c =================================================================== RCS file: src/sys/dev/usb/umbg.c,v retrieving revision 1.27 diff -u -p -r1.27 umbg.c --- dev/usb/umbg.c 31 Jul 2020 10:49:33 -0000 1.27 +++ dev/usb/umbg.c 1 Jul 2022 13:49:10 -0000 @@ -20,9 +20,7 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/conf.h> -#include <sys/select.h> #include <sys/device.h> -#include <sys/poll.h> #include <sys/time.h> #include <sys/sensors.h> #include <sys/timeout.h> Index: dev/usb/umct.c =================================================================== RCS file: src/sys/dev/usb/umct.c,v retrieving revision 1.49 diff -u -p -r1.49 umct.c --- dev/usb/umct.c 9 Apr 2022 20:07:44 -0000 1.49 +++ dev/usb/umct.c 1 Jul 2022 13:49:10 -0000 @@ -42,9 +42,7 @@ #include <sys/ioctl.h> #include <sys/conf.h> #include <sys/tty.h> -#include <sys/selinfo.h> #include <sys/device.h> -#include <sys/poll.h> #include <dev/usb/usb.h> #include <dev/usb/usbcdc.h> Index: dev/usb/umidi.c =================================================================== RCS file: src/sys/dev/usb/umidi.c,v retrieving revision 1.55 diff -u -p -r1.55 umidi.c --- dev/usb/umidi.c 21 Mar 2022 19:22:42 -0000 1.55 +++ dev/usb/umidi.c 1 Jul 2022 13:49:10 -0000 @@ -37,8 +37,6 @@ #include <sys/ioctl.h> #include <sys/conf.h> #include <sys/fcntl.h> -#include <sys/selinfo.h> -#include <sys/poll.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> Index: dev/usb/umidi_quirks.c =================================================================== RCS file: src/sys/dev/usb/umidi_quirks.c,v retrieving revision 1.16 diff -u -p -r1.16 umidi_quirks.c --- dev/usb/umidi_quirks.c 18 Jan 2018 18:09:38 -0000 1.16 +++ dev/usb/umidi_quirks.c 1 Jul 2022 13:49:10 -0000 @@ -36,8 +36,6 @@ #include <sys/device.h> #include <sys/ioctl.h> #include <sys/conf.h> -#include <sys/selinfo.h> -#include <sys/poll.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> Index: dev/usb/umodem.c =================================================================== RCS file: src/sys/dev/usb/umodem.c,v retrieving revision 1.68 diff -u -p -r1.68 umodem.c --- dev/usb/umodem.c 9 Apr 2022 20:07:44 -0000 1.68 +++ dev/usb/umodem.c 1 Jul 2022 13:49:10 -0000 @@ -49,9 +49,7 @@ #include <sys/kernel.h> #include <sys/conf.h> #include <sys/tty.h> -#include <sys/selinfo.h> #include <sys/device.h> -#include <sys/poll.h> #include <dev/usb/usb.h> #include <dev/usb/usbcdc.h> Index: dev/usb/uplcom.c =================================================================== RCS file: src/sys/dev/usb/uplcom.c,v retrieving revision 1.79 diff -u -p -r1.79 uplcom.c --- dev/usb/uplcom.c 9 Apr 2022 20:07:44 -0000 1.79 +++ dev/usb/uplcom.c 1 Jul 2022 13:49:10 -0000 @@ -44,9 +44,7 @@ #include <sys/ioctl.h> #include <sys/conf.h> #include <sys/tty.h> -#include <sys/selinfo.h> #include <sys/device.h> -#include <sys/poll.h> #include <dev/usb/usb.h> #include <dev/usb/usbcdc.h> Index: dev/usb/usb.c =================================================================== RCS file: src/sys/dev/usb/usb.c,v retrieving revision 1.129 diff -u -p -r1.129 usb.c --- dev/usb/usb.c 9 Jan 2022 05:43:02 -0000 1.129 +++ dev/usb/usb.c 1 Jul 2022 13:49:10 -0000 @@ -49,8 +49,6 @@ #include <sys/kthread.h> #include <sys/conf.h> #include <sys/fcntl.h> -#include <sys/poll.h> -#include <sys/selinfo.h> #include <sys/signalvar.h> #include <sys/time.h> #include <sys/rwlock.h> Index: dev/usb/uvideo.c =================================================================== RCS file: src/sys/dev/usb/uvideo.c,v retrieving revision 1.216 diff -u -p -r1.216 uvideo.c --- dev/usb/uvideo.c 21 Mar 2022 19:22:42 -0000 1.216 +++ dev/usb/uvideo.c 1 Jul 2022 13:49:10 -0000 @@ -25,10 +25,8 @@ #include <sys/ioctl.h> #include <sys/tty.h> #include <sys/fcntl.h> -#include <sys/selinfo.h> #include <sys/lock.h> #include <sys/stat.h> -#include <sys/poll.h> #include <sys/timeout.h> #include <sys/kthread.h> #include <sys/stdint.h> Index: dev/usb/uvscom.c =================================================================== RCS file: src/sys/dev/usb/uvscom.c,v retrieving revision 1.41 diff -u -p -r1.41 uvscom.c --- dev/usb/uvscom.c 9 Apr 2022 20:07:44 -0000 1.41 +++ dev/usb/uvscom.c 1 Jul 2022 13:49:10 -0000 @@ -44,7 +44,6 @@ #include <sys/tty.h> #include <sys/ioctl.h> #include <sys/device.h> -#include <sys/poll.h> #include <dev/usb/usb.h> #include <dev/usb/usbcdc.h> Index: dev/usb/dwc2/dwc2.c =================================================================== RCS file: src/sys/dev/usb/dwc2/dwc2.c,v retrieving revision 1.61 diff -u -p -r1.61 dwc2.c --- dev/usb/dwc2/dwc2.c 1 May 2022 10:28:54 -0000 1.61 +++ dev/usb/dwc2/dwc2.c 1 Jul 2022 13:49:10 -0000 @@ -35,7 +35,6 @@ #include <sys/malloc.h> #include <sys/kernel.h> #include <sys/device.h> -#include <sys/select.h> #include <sys/proc.h> #include <sys/queue.h> #include <sys/endian.h> Index: dev/wscons/wsdisplay.c =================================================================== RCS file: src/sys/dev/wscons/wsdisplay.c,v retrieving revision 1.145 diff -u -p -r1.145 wsdisplay.c --- dev/wscons/wsdisplay.c 20 Jun 2022 16:28:42 -0000 1.145 +++ dev/wscons/wsdisplay.c 1 Jul 2022 13:49:10 -0000 @@ -45,7 +45,6 @@ #include <sys/fcntl.h> #include <sys/vnode.h> #include <sys/timeout.h> -#include <sys/poll.h> #include <dev/wscons/wscons_features.h> #include <dev/wscons/wsconsio.h> @@ -1404,24 +1403,6 @@ wsdisplaymmap(dev_t dev, off_t offset, i /* pass mmap to display */ return ((*sc->sc_accessops->mmap)(sc->sc_accesscookie, offset, prot)); -} - -int -wsdisplaypoll(dev_t dev, int events, struct proc *p) -{ - struct wsdisplay_softc *sc = wsdisplay_cd.cd_devs[WSDISPLAYUNIT(dev)]; - struct wsscreen *scr; - - if (ISWSDISPLAYCTL(dev)) - return (0); - - if ((scr = sc->sc_scr[WSDISPLAYSCREEN(dev)]) == NULL) - return (POLLERR); - - if (!WSSCREEN_HAS_TTY(scr)) - return (POLLERR); - - return (ttpoll(dev, events, p)); } int Index: dev/wscons/wsevent.c =================================================================== RCS file: src/sys/dev/wscons/wsevent.c,v retrieving revision 1.25 diff -u -p -r1.25 wsevent.c --- dev/wscons/wsevent.c 25 Dec 2020 12:59:52 -0000 1.25 +++ dev/wscons/wsevent.c 1 Jul 2022 13:49:10 -0000 @@ -79,8 +79,6 @@ #include <sys/malloc.h> #include <sys/systm.h> #include <sys/vnode.h> -#include <sys/selinfo.h> -#include <sys/poll.h> #include <dev/wscons/wsconsio.h> #include <dev/wscons/wseventvar.h> @@ -140,7 +138,7 @@ wsevent_fini(struct wseventvar *ev) } /* - * User-level interface: read, poll. + * User-level interface: read, kqueue. * (User cannot write an event queue.) */ int @@ -198,23 +196,6 @@ wsevent_read(struct wseventvar *ev, stru cnt * sizeof(struct wscons_event), uio); ev->get = cnt; return (error); -} - -int -wsevent_poll(struct wseventvar *ev, int events, struct proc *p) -{ - int revents = 0; - int s = splwsevent(); - - if (events & (POLLIN | POLLRDNORM)) { - if (ev->get != ev->put) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &ev->sel); - } - - splx(s); - return (revents); } int Index: dev/wscons/wseventvar.h =================================================================== RCS file: src/sys/dev/wscons/wseventvar.h,v retrieving revision 1.10 diff -u -p -r1.10 wseventvar.h --- dev/wscons/wseventvar.h 22 May 2019 18:52:14 -0000 1.10 +++ dev/wscons/wseventvar.h 1 Jul 2022 13:49:10 -0000 @@ -107,7 +107,6 @@ struct wseventvar { int wsevent_init(struct wseventvar *); void wsevent_fini(struct wseventvar *); int wsevent_read(struct wseventvar *, struct uio *, int); -int wsevent_poll(struct wseventvar *, int, struct proc *); int wsevent_kqfilter(struct wseventvar *, struct knote *); /* Index: dev/wscons/wskbd.c =================================================================== RCS file: src/sys/dev/wscons/wskbd.c,v retrieving revision 1.112 diff -u -p -r1.112 wskbd.c --- dev/wscons/wskbd.c 6 Apr 2022 18:59:30 -0000 1.112 +++ dev/wscons/wskbd.c 1 Jul 2022 13:49:10 -0000 @@ -94,7 +94,6 @@ #include <sys/errno.h> #include <sys/fcntl.h> #include <sys/vnode.h> -#include <sys/poll.h> #include <ddb/db_var.h> @@ -1254,16 +1253,6 @@ getkeyrepeat: } #endif return (error); -} - -int -wskbdpoll(dev_t dev, int events, struct proc *p) -{ - struct wskbd_softc *sc = wskbd_cd.cd_devs[minor(dev)]; - - if (sc->sc_base.me_evp == NULL) - return (POLLERR); - return (wsevent_poll(sc->sc_base.me_evp, events, p)); } int Index: dev/wscons/wsmouse.c =================================================================== RCS file: src/sys/dev/wscons/wsmouse.c,v retrieving revision 1.68 diff -u -p -r1.68 wsmouse.c --- dev/wscons/wsmouse.c 6 Apr 2022 18:59:30 -0000 1.68 +++ dev/wscons/wsmouse.c 1 Jul 2022 13:49:11 -0000 @@ -103,7 +103,6 @@ #include <sys/signalvar.h> #include <sys/device.h> #include <sys/vnode.h> -#include <sys/poll.h> #include <sys/malloc.h> #include <dev/wscons/wscons_features.h> @@ -531,16 +530,6 @@ wsmouse_do_ioctl(struct wsmouse_softc *s error = (*sc->sc_accessops->ioctl)(sc->sc_accesscookie, cmd, data, flag, p); return (error != -1 ? error : ENOTTY); -} - -int -wsmousepoll(dev_t dev, int events, struct proc *p) -{ - struct wsmouse_softc *sc = wsmouse_cd.cd_devs[minor(dev)]; - - if (sc->sc_base.me_evp == NULL) - return (POLLERR); - return (wsevent_poll(sc->sc_base.me_evp, events, p)); } int Index: dev/wscons/wsmux.c =================================================================== RCS file: src/sys/dev/wscons/wsmux.c,v retrieving revision 1.55 diff -u -p -r1.55 wsmux.c --- dev/wscons/wsmux.c 22 Sep 2021 15:44:12 -0000 1.55 +++ dev/wscons/wsmux.c 1 Jul 2022 13:49:11 -0000 @@ -55,7 +55,6 @@ #include <sys/tty.h> #include <sys/signalvar.h> #include <sys/device.h> -#include <sys/poll.h> #include <dev/wscons/wsconsio.h> #include <dev/wscons/wsksymdef.h> @@ -559,24 +558,6 @@ wsmux_do_ioctl(struct device *dv, u_long error = 0; return (error); -} - -/* - * poll() of the pseudo device from device table. - */ -int -wsmuxpoll(dev_t dev, int events, struct proc *p) -{ - struct wsmux_softc *sc = wsmuxdevs[minor(dev)]; - - if (sc->sc_base.me_evp == NULL) { -#ifdef DIAGNOSTIC - printf("wsmuxpoll: not open\n"); -#endif - return (POLLERR); - } - - return (wsevent_poll(sc->sc_base.me_evp, events, p)); } int Index: kern/subr_log.c =================================================================== RCS file: src/sys/kern/subr_log.c,v retrieving revision 1.74 diff -u -p -r1.74 subr_log.c --- kern/subr_log.c 18 Mar 2021 08:43:38 -0000 1.74 +++ kern/subr_log.c 1 Jul 2022 13:49:11 -0000 @@ -46,7 +46,6 @@ #include <sys/tty.h> #include <sys/signalvar.h> #include <sys/syslog.h> -#include <sys/poll.h> #include <sys/malloc.h> #include <sys/filedesc.h> #include <sys/socket.h> @@ -297,22 +296,6 @@ logread(dev_t dev, struct uio *uio, int out: mtx_leave(&log_mtx); return (error); -} - -int -logpoll(dev_t dev, int events, struct proc *p) -{ - int revents = 0; - - mtx_enter(&log_mtx); - if (events & (POLLIN | POLLRDNORM)) { - if (msgbufp->msg_bufr != msgbufp->msg_bufx) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &logsoftc.sc_selp); - } - mtx_leave(&log_mtx); - return (revents); } int Index: kern/tty.c =================================================================== RCS file: src/sys/kern/tty.c,v retrieving revision 1.174 diff -u -p -r1.174 tty.c --- kern/tty.c 15 Feb 2022 03:53:58 -0000 1.174 +++ kern/tty.c 1 Jul 2022 13:49:11 -0000 @@ -57,7 +57,6 @@ #include <sys/resourcevar.h> #include <sys/sysctl.h> #include <sys/pool.h> -#include <sys/poll.h> #include <sys/unistd.h> #include <sys/pledge.h> @@ -1056,38 +1055,6 @@ ttioctl(struct tty *tp, u_long cmd, cadd return (-1); } return (0); -} - -int -ttpoll(dev_t device, int events, struct proc *p) -{ - struct tty *tp; - int revents, s; - - tp = (*cdevsw[major(device)].d_tty)(device); - - revents = 0; - s = spltty(); - if (events & (POLLIN | POLLRDNORM)) { - if (ttnread(tp) > 0 || (!ISSET(tp->t_cflag, CLOCAL) && - !ISSET(tp->t_state, TS_CARR_ON))) - revents |= events & (POLLIN | POLLRDNORM); - } - /* NOTE: POLLHUP and POLLOUT/POLLWRNORM are mutually exclusive */ - if (!ISSET(tp->t_cflag, CLOCAL) && !ISSET(tp->t_state, TS_CARR_ON)) { - revents |= POLLHUP; - } else if (events & (POLLOUT | POLLWRNORM)) { - if (tp->t_outq.c_cc <= tp->t_lowat) - revents |= events & (POLLOUT | POLLWRNORM); - } - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &tp->t_rsel); - if (events & (POLLOUT | POLLWRNORM)) - selrecord(p, &tp->t_wsel); - } - splx(s); - return (revents); } const struct filterops ttyread_filtops = { Index: kern/tty_pty.c =================================================================== RCS file: src/sys/kern/tty_pty.c,v retrieving revision 1.112 diff -u -p -r1.112 tty_pty.c --- kern/tty_pty.c 15 Dec 2021 15:30:47 -0000 1.112 +++ kern/tty_pty.c 1 Jul 2022 13:49:11 -0000 @@ -55,7 +55,6 @@ #include <sys/conf.h> #include <sys/stat.h> #include <sys/sysctl.h> -#include <sys/poll.h> #include <sys/pledge.h> #include <sys/rwlock.h> @@ -600,55 +599,6 @@ done: if (bufcc) explicit_bzero(buf, bufcc); return (error); -} - -int -ptcpoll(dev_t dev, int events, struct proc *p) -{ - struct pt_softc *pti = pt_softc[minor(dev)]; - struct tty *tp = pti->pt_tty; - int revents = 0, s; - - if (!ISSET(tp->t_state, TS_ISOPEN) && ISSET(tp->t_state, TS_CARR_ON)) - goto notopen; - - if (events & (POLLIN | POLLRDNORM)) { - /* - * Need to protect access to t_outq - */ - s = spltty(); - if ((tp->t_outq.c_cc && !ISSET(tp->t_state, TS_TTSTOP)) || - ((pti->pt_flags & PF_PKT) && pti->pt_send) || - ((pti->pt_flags & PF_UCNTL) && pti->pt_ucntl)) - revents |= events & (POLLIN | POLLRDNORM); - splx(s); - } - /* NOTE: POLLHUP and POLLOUT/POLLWRNORM are mutually exclusive */ - if (!ISSET(tp->t_state, TS_CARR_ON)) { - revents |= POLLHUP; - } else if (events & (POLLOUT | POLLWRNORM)) { - if ((pti->pt_flags & PF_REMOTE) ? - (tp->t_canq.c_cc == 0) : - ((tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG(tp) - 2) || - (tp->t_canq.c_cc == 0 && ISSET(tp->t_lflag, ICANON)))) - revents |= events & (POLLOUT | POLLWRNORM); - } - if (events & (POLLPRI | POLLRDBAND)) { - /* If in packet or user control mode, check for data. */ - if (((pti->pt_flags & PF_PKT) && pti->pt_send) || - ((pti->pt_flags & PF_UCNTL) && pti->pt_ucntl)) - revents |= events & (POLLPRI | POLLRDBAND); - } - - if (revents == 0) { -notopen: - if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) - selrecord(p, &pti->pt_selr); - if (events & (POLLOUT | POLLWRNORM)) - selrecord(p, &pti->pt_selw); - } - - return (revents); } void Index: miscfs/fuse/fuse_device.c =================================================================== RCS file: src/sys/miscfs/fuse/fuse_device.c,v retrieving revision 1.36 diff -u -p -r1.36 fuse_device.c --- miscfs/fuse/fuse_device.c 11 Mar 2021 13:31:35 -0000 1.36 +++ miscfs/fuse/fuse_device.c 1 Jul 2022 13:49:11 -0000 @@ -21,7 +21,6 @@ #include <sys/ioctl.h> #include <sys/malloc.h> #include <sys/mount.h> -#include <sys/poll.h> #include <sys/stat.h> #include <sys/statvfs.h> #include <sys/vnode.h> @@ -64,7 +63,6 @@ int fuseclose(dev_t, int, int, struct pr int fuseioctl(dev_t, u_long, caddr_t, int, struct proc *); int fuseread(dev_t, struct uio *, int); int fusewrite(dev_t, struct uio *, int); -int fusepoll(dev_t, int, struct proc *); int fusekqfilter(dev_t dev, struct knote *kn); int filt_fuse_read(struct knote *, long); void filt_fuse_rdetach(struct knote *); @@ -506,30 +504,6 @@ end: } return (error); -} - -int -fusepoll(dev_t dev, int events, struct proc *p) -{ - struct fuse_d *fd; - int revents = 0; - - fd = fuse_lookup(minor(dev)); - if (fd == NULL) - return (POLLERR); - - if (events & (POLLIN | POLLRDNORM)) - if (!SIMPLEQ_EMPTY(&fd->fd_fbufs_in)) - revents |= events & (POLLIN | POLLRDNORM); - - if (events & (POLLOUT | POLLWRNORM)) - revents |= events & (POLLOUT | POLLWRNORM); - - if (revents == 0) - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &fd->fd_rsel); - - return (revents); } int Index: net/bpf.c =================================================================== RCS file: src/sys/net/bpf.c,v retrieving revision 1.216 diff -u -p -r1.216 bpf.c --- net/bpf.c 17 Mar 2022 14:22:03 -0000 1.216 +++ net/bpf.c 1 Jul 2022 13:49:11 -0000 @@ -50,7 +50,6 @@ #include <sys/vnode.h> #include <sys/fcntl.h> #include <sys/socket.h> -#include <sys/poll.h> #include <sys/kernel.h> #include <sys/sysctl.h> #include <sys/rwlock.h> @@ -98,7 +97,6 @@ void bpf_mcopy(const void *, void *, siz int bpf_movein(struct uio *, struct bpf_d *, struct mbuf **, struct sockaddr *); int bpf_setif(struct bpf_d *, struct ifreq *); -int bpfpoll(dev_t, int, struct proc *); int bpfkqfilter(dev_t, struct knote *); void bpf_wakeup(struct bpf_d *); void bpf_wakeup_cb(void *); @@ -1141,46 +1139,6 @@ void bpf_ifname(struct bpf_if *bif, struct ifreq *ifr) { bcopy(bif->bif_name, ifr->ifr_name, sizeof(ifr->ifr_name)); -} - -/* - * Support for poll() system call - */ -int -bpfpoll(dev_t dev, int events, struct proc *p) -{ - struct bpf_d *d; - int revents; - - KERNEL_ASSERT_LOCKED(); - - /* - * An imitation of the FIONREAD ioctl code. - */ - d = bpfilter_lookup(minor(dev)); - - /* - * XXX The USB stack manages it to trigger some race condition - * which causes bpfilter_lookup to return NULL when a USB device - * gets detached while it is up and has an open bpf handler (e.g. - * dhclient). We still should recheck if we can fix the root - * cause of this issue. - */ - if (d == NULL) - return (POLLERR); - - /* Always ready to write data */ - revents = events & (POLLOUT | POLLWRNORM); - - if (events & (POLLIN | POLLRDNORM)) { - mtx_enter(&d->bd_mtx); - if (d->bd_hlen != 0 || (d->bd_immediate && d->bd_slen != 0)) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &d->bd_sel); - mtx_leave(&d->bd_mtx); - } - return (revents); } const struct filterops bpfread_filtops = { Index: net/if_pppx.c =================================================================== RCS file: src/sys/net/if_pppx.c,v retrieving revision 1.117 diff -u -p -r1.117 if_pppx.c --- net/if_pppx.c 26 Jun 2022 22:51:58 -0000 1.117 +++ net/if_pppx.c 1 Jul 2022 13:49:11 -0000 @@ -56,7 +56,6 @@ #include <sys/socket.h> #include <sys/ioctl.h> #include <sys/vnode.h> -#include <sys/poll.h> #include <sys/selinfo.h> #include <net/if.h> @@ -448,27 +447,6 @@ pppxioctl(dev_t dev, u_long cmd, caddr_t } int -pppxpoll(dev_t dev, int events, struct proc *p) -{ - struct pppx_dev *pxd = pppx_dev2pxd(dev); - int revents = 0; - - if (events & (POLLIN | POLLRDNORM)) { - if (!mq_empty(&pxd->pxd_svcq)) - revents |= events & (POLLIN | POLLRDNORM); - } - if (events & (POLLOUT | POLLWRNORM)) - revents |= events & (POLLOUT | POLLWRNORM); - - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &pxd->pxd_rsel); - } - - return (revents); -} - -int pppxkqfilter(dev_t dev, struct knote *kn) { struct pppx_dev *pxd = pppx_dev2pxd(dev); @@ -1210,27 +1188,6 @@ pppacioctl(dev_t dev, u_long cmd, caddr_ NET_UNLOCK(); return (error); -} - -int -pppacpoll(dev_t dev, int events, struct proc *p) -{ - struct pppac_softc *sc = pppac_lookup(dev); - int revents = 0; - - if (events & (POLLIN | POLLRDNORM)) { - if (!mq_empty(&sc->sc_mq)) - revents |= events & (POLLIN | POLLRDNORM); - } - if (events & (POLLOUT | POLLWRNORM)) - revents |= events & (POLLOUT | POLLWRNORM); - - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &sc->sc_rsel); - } - - return (revents); } int Index: net/if_tun.c =================================================================== RCS file: src/sys/net/if_tun.c,v retrieving revision 1.236 diff -u -p -r1.236 if_tun.c --- net/if_tun.c 26 Feb 2022 02:15:45 -0000 1.236 +++ net/if_tun.c 1 Jul 2022 13:49:11 -0000 @@ -53,7 +53,6 @@ #include <sys/device.h> #include <sys/vnode.h> #include <sys/signalvar.h> -#include <sys/poll.h> #include <sys/conf.h> #include <sys/smr.h> @@ -110,7 +109,6 @@ int tun_dev_close(dev_t, struct proc *); int tun_dev_ioctl(dev_t, u_long, void *); int tun_dev_read(dev_t, struct uio *, int); int tun_dev_write(dev_t, struct uio *, int, int); -int tun_dev_poll(dev_t, int, struct proc *); int tun_dev_kqfilter(dev_t, struct knote *); int tun_ioctl(struct ifnet *, u_long, caddr_t); @@ -941,50 +939,6 @@ tun_input(struct ifnet *ifp, struct mbuf m_freem(m0); break; } -} - -/* - * tunpoll - the poll interface, this is only useful on reads - * really. The write detect always returns true, write never blocks - * anyway, it either accepts the packet or drops it. - */ -int -tunpoll(dev_t dev, int events, struct proc *p) -{ - return (tun_dev_poll(dev, events, p)); -} - -int -tappoll(dev_t dev, int events, struct proc *p) -{ - return (tun_dev_poll(dev, events, p)); -} - -int -tun_dev_poll(dev_t dev, int events, struct proc *p) -{ - struct tun_softc *sc; - struct ifnet *ifp; - int revents; - - sc = tun_get(dev); - if (sc == NULL) - return (POLLERR); - - ifp = &sc->sc_if; - revents = 0; - - if (events & (POLLIN | POLLRDNORM)) { - if (!ifq_empty(&ifp->if_snd)) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &sc->sc_rsel); - } - if (events & (POLLOUT | POLLWRNORM)) - revents |= events & (POLLOUT | POLLWRNORM); - - tun_put(sc); - return (revents); } int Index: net/pipex.c =================================================================== RCS file: src/sys/net/pipex.c,v retrieving revision 1.142 diff -u -p -r1.142 pipex.c --- net/pipex.c 28 Jun 2022 08:01:40 -0000 1.142 +++ net/pipex.c 1 Jul 2022 13:49:11 -0000 @@ -31,7 +31,6 @@ #include <sys/mbuf.h> #include <sys/socket.h> #include <sys/ioctl.h> -#include <sys/select.h> #include <sys/sysctl.h> #include <sys/syslog.h> #include <sys/conf.h> Index: scsi/mpath.c =================================================================== RCS file: src/sys/scsi/mpath.c,v retrieving revision 1.56 diff -u -p -r1.56 mpath.c --- scsi/mpath.c 16 Apr 2022 19:19:59 -0000 1.56 +++ scsi/mpath.c 1 Jul 2022 13:49:11 -0000 @@ -25,8 +25,6 @@ #include <sys/queue.h> #include <sys/rwlock.h> #include <sys/ioctl.h> -#include <sys/poll.h> -#include <sys/selinfo.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> Index: scsi/mpath_emc.c =================================================================== RCS file: src/sys/scsi/mpath_emc.c,v retrieving revision 1.24 diff -u -p -r1.24 mpath_emc.c --- scsi/mpath_emc.c 24 Oct 2021 16:57:30 -0000 1.24 +++ scsi/mpath_emc.c 1 Jul 2022 13:49:11 -0000 @@ -28,8 +28,6 @@ #include <sys/rwlock.h> #include <sys/pool.h> #include <sys/ioctl.h> -#include <sys/poll.h> -#include <sys/selinfo.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> Index: scsi/mpath_hds.c =================================================================== RCS file: src/sys/scsi/mpath_hds.c,v retrieving revision 1.25 diff -u -p -r1.25 mpath_hds.c --- scsi/mpath_hds.c 24 Oct 2021 16:57:30 -0000 1.25 +++ scsi/mpath_hds.c 1 Jul 2022 13:49:11 -0000 @@ -28,8 +28,6 @@ #include <sys/rwlock.h> #include <sys/pool.h> #include <sys/ioctl.h> -#include <sys/poll.h> -#include <sys/selinfo.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> Index: scsi/mpath_rdac.c =================================================================== RCS file: src/sys/scsi/mpath_rdac.c,v retrieving revision 1.26 diff -u -p -r1.26 mpath_rdac.c --- scsi/mpath_rdac.c 24 Oct 2021 16:57:30 -0000 1.26 +++ scsi/mpath_rdac.c 1 Jul 2022 13:49:11 -0000 @@ -28,8 +28,6 @@ #include <sys/rwlock.h> #include <sys/pool.h> #include <sys/ioctl.h> -#include <sys/poll.h> -#include <sys/selinfo.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> Index: scsi/mpath_sym.c =================================================================== RCS file: src/sys/scsi/mpath_sym.c,v retrieving revision 1.27 diff -u -p -r1.27 mpath_sym.c --- scsi/mpath_sym.c 24 Oct 2021 16:57:30 -0000 1.27 +++ scsi/mpath_sym.c 1 Jul 2022 13:49:11 -0000 @@ -26,8 +26,6 @@ #include <sys/rwlock.h> #include <sys/pool.h> #include <sys/ioctl.h> -#include <sys/poll.h> -#include <sys/selinfo.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> Index: sys/tty.h =================================================================== RCS file: src/sys/sys/tty.h,v retrieving revision 1.40 diff -u -p -r1.40 tty.h --- sys/tty.h 2 Dec 2021 15:13:49 -0000 1.40 +++ sys/tty.h 1 Jul 2022 13:49:11 -0000 @@ -272,7 +272,6 @@ int ttioctl(struct tty *tp, u_long com, struct proc *p); int ttread(struct tty *tp, struct uio *uio, int flag); void ttrstrt(void *tp); -int ttpoll(dev_t device, int events, struct proc *p); int ttkqfilter(dev_t dev, struct knote *kn); void ttsetwater(struct tty *tp); int ttspeedtab(int speed, const struct speedtab *table);