kernel - Tear out device polling
authorSamuel J. Greear <sjg@thesjg.com>
Sun, 11 Jul 2010 16:23:55 +0000 (16:23 +0000)
committerSamuel J. Greear <sjg@thesjg.com>
Sun, 11 Jul 2010 16:23:55 +0000 (16:23 +0000)
* Remove existing (now legacy) code that implements device polling, kq filters
  are now the "One True (and only) Way"

* Add dummy write filters (always true) for devices: targ, vinum, snp, tw
  and apm

70 files changed:
sys/bus/cam/scsi/scsi_target.c
sys/bus/firewire/fwdev.c
sys/bus/firewire/fwmem.c
sys/bus/firewire/fwmem.h
sys/bus/usb/usb.c
sys/dev/drm/drmP.h
sys/dev/drm/drm_drv.c
sys/dev/drm/drm_fops.c
sys/dev/misc/cmx/cmx.c
sys/dev/misc/dcons/dcons_os.c
sys/dev/misc/hotplug/hotplug.c
sys/dev/misc/kbd/kbd.c
sys/dev/misc/mse/mse.c
sys/dev/misc/nmdm/nmdm.c
sys/dev/misc/psm/psm.c
sys/dev/misc/snp/snp.c
sys/dev/misc/spic/spic.c
sys/dev/misc/syscons/syscons.c
sys/dev/misc/syscons/sysmouse.c
sys/dev/misc/tw/tw.c
sys/dev/raid/aac/aac.c
sys/dev/raid/vinum/vinum.c
sys/dev/raid/vinum/vinumext.h
sys/dev/serial/cy/cy.c
sys/dev/serial/dgb/dgm.c
sys/dev/serial/digi/digi.c
sys/dev/serial/rc/rc.c
sys/dev/serial/rp/rp.c
sys/dev/serial/si/si.c
sys/dev/serial/sio/sio.c
sys/dev/serial/stl/stallion.c
sys/dev/serial/stli/istallion.c
sys/dev/sound/pcm/dsp.c
sys/dev/usbmisc/ucom/ucom.c
sys/dev/usbmisc/ugen/ugen.c
sys/dev/usbmisc/uhid/uhid.c
sys/dev/usbmisc/ums/ums.c
sys/dev/usbmisc/uscanner/uscanner.c
sys/dev/video/bktr/bktr_os.c
sys/dev/video/cxm/cxm.c
sys/kern/kern_device.c
sys/kern/kern_memio.c
sys/kern/kern_udev.c
sys/kern/subr_bus.c
sys/kern/subr_log.c
sys/kern/tty.c
sys/kern/tty_cons.c
sys/kern/tty_pty.c
sys/kern/tty_tty.c
sys/net/bpf.c
sys/net/i4b/driver/i4b_ctl.c
sys/net/i4b/driver/i4b_rbch.c
sys/net/i4b/driver/i4b_tel.c
sys/net/i4b/driver/i4b_trace.c
sys/net/i4b/layer4/i4b_i4bdrv.c
sys/net/tap/if_tap.c
sys/net/tun/if_tun.c
sys/netproto/smb/smb_dev.c
sys/platform/pc32/acpica5/acpi_machdep.c
sys/platform/pc32/apm/apm.c
sys/platform/pc32/gnu/isa/dgb.c
sys/platform/pc32/isa/asc.c
sys/platform/pc64/acpica5/acpi_machdep.c
sys/platform/pc64/apm/apm.c
sys/platform/pc64/isa/asc.c
sys/platform/vkernel/platform/console.c
sys/platform/vkernel64/platform/console.c
sys/sys/device.h
sys/sys/tty.h
sys/vfs/devfs/devfs_vnops.c

index afdc596..e3e2379 100644 (file)
@@ -36,7 +36,6 @@
 #include <sys/conf.h>
 #include <sys/device.h>
 #include <sys/malloc.h>
-#include <sys/poll.h>
 #include <sys/vnode.h>
 #include <sys/devicestat.h>
 #include <sys/thread2.h>
@@ -98,15 +97,17 @@ static d_close_t    targclose;
 static d_read_t                targread;
 static d_write_t       targwrite;
 static d_ioctl_t       targioctl;
-static d_poll_t                targpoll;
 static d_kqfilter_t    targkqfilter;
 static d_clone_t       targclone;
 DEVFS_DECLARE_CLONE_BITMAP(targ);
 
-static void            targreadfiltdetach(struct knote *kn);
+static void            targfiltdetach(struct knote *kn);
 static int             targreadfilt(struct knote *kn, long hint);
+static int             targwritefilt(struct knote *kn, long hint);
 static struct filterops targread_filtops =
-       { 1, NULL, targreadfiltdetach, targreadfilt };
+       { 1, NULL, targfiltdetach, targreadfilt };
+static struct filterops targwrite_filtops =
+       { 1, NULL, targfiltdetach, targwritefilt };
 
 #define TARG_CDEV_MAJOR 65
 static struct dev_ops targ_ops = {
@@ -116,7 +117,6 @@ static struct dev_ops targ_ops = {
        .d_read = targread,
        .d_write = targwrite,
        .d_ioctl = targioctl,
-       .d_poll = targpoll,
        .d_kqfilter = targkqfilter
 };
 
@@ -321,33 +321,6 @@ targioctl(struct dev_ioctl_args *ap)
        return (targcamstatus(status));
 }
 
-/* Writes are always ready, reads wait for user_ccb_queue or abort_queue */
-static int
-targpoll(struct dev_poll_args *ap)
-{
-       struct targ_softc *softc;
-       int     revents;
-
-       softc = (struct targ_softc *)ap->a_head.a_dev->si_drv1;
-
-       /* Poll for write() is always ok. */
-       revents = ap->a_events & (POLLOUT | POLLWRNORM);
-       if ((ap->a_events & (POLLIN | POLLRDNORM)) != 0) {
-               /* Poll for read() depends on user and abort queues. */
-               cam_periph_lock(softc->periph);
-               if (!TAILQ_EMPTY(&softc->user_ccb_queue) ||
-                   !TAILQ_EMPTY(&softc->abort_queue)) {
-                       revents |= ap->a_events & (POLLIN | POLLRDNORM);
-               }
-               cam_periph_unlock(softc->periph);
-               /* Only sleep if the user didn't poll for write. */
-               if (revents == 0)
-                       selrecord(curthread, &softc->read_select);
-       }
-       ap->a_events = revents;
-       return (0);
-}
-
 static int
 targkqfilter(struct dev_kqfilter_args *ap)
 {
@@ -355,8 +328,22 @@ targkqfilter(struct dev_kqfilter_args *ap)
        struct  targ_softc *softc;
 
        softc = (struct targ_softc *)ap->a_head.a_dev->si_drv1;
-       kn->kn_hook = (caddr_t)softc;
-       kn->kn_fop = &targread_filtops;
+
+       ap->a_result = 0;
+
+       switch (kn->kn_filter) {
+       case EVFILT_READ:
+               kn->kn_hook = (caddr_t)softc;
+               kn->kn_fop = &targread_filtops;
+               break;
+       case EVFILT_WRITE:
+               kn->kn_hook = (caddr_t)softc;
+               kn->kn_fop = &targwrite_filtops;
+       default:
+               ap->a_result = EOPNOTSUPP;
+               return (0);
+       }
+
        crit_enter();
        SLIST_INSERT_HEAD(&softc->read_select.si_note, kn, kn_selnext);
        crit_exit();
@@ -364,7 +351,7 @@ targkqfilter(struct dev_kqfilter_args *ap)
 }
 
 static void
-targreadfiltdetach(struct knote *kn)
+targfiltdetach(struct knote *kn)
 {
        struct  targ_softc *softc;
 
@@ -389,6 +376,13 @@ targreadfilt(struct knote *kn, long hint)
        return (retval);
 }
 
+/* write() is always ok */
+static int
+targwritefilt(struct knote *kn, long hint)
+{
+       return (1);
+}
+
 /* Send the HBA the enable/disable message */
 static cam_status
 targendislun(struct cam_path *path, int enable, int grp6_len, int grp7_len)
index 17ed38e..206f7c7 100644 (file)
@@ -49,7 +49,6 @@
 #include <sys/kernel.h>
 #include <sys/malloc.h>
 #include <sys/conf.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 
 #include <sys/bus.h>
@@ -77,7 +76,6 @@
 static d_open_t        fw_open;
 static d_close_t       fw_close;
 static d_ioctl_t       fw_ioctl;
-static d_poll_t        fw_poll;
 static d_kqfilter_t    fw_kqfilter;
 static d_read_t        fw_read;        /* for Isochronous packet */
 static d_write_t       fw_write;
@@ -96,7 +94,6 @@ struct dev_ops firewire_ops =
        .d_read =       fw_read,
        .d_write =      fw_write,
        .d_ioctl =      fw_ioctl,
-       .d_poll =       fw_poll,
        .d_kqfilter =   fw_kqfilter,
        .d_mmap =       fw_mmap,
        .d_strategy =   fw_strategy,
@@ -715,37 +712,6 @@ out:
        }
        return err;
 }
-int
-fw_poll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       struct firewire_softc *sc;
-       struct fw_xferq *ir;
-       int revents;
-       int tmp;
-       int unit = DEV2UNIT(dev);
-
-       if (DEV_FWMEM(dev))
-               return fwmem_poll(ap);
-
-       sc = devclass_get_softc(firewire_devclass, unit);
-       ir = ((struct fw_drv1 *)dev->si_drv1)->ir;
-       revents = 0;
-       tmp = POLLIN | POLLRDNORM;
-       if (ap->a_events & tmp) {
-               if (STAILQ_FIRST(&ir->q) != NULL)
-                       revents |= tmp;
-               else
-                       selrecord(curthread, &ir->rsel);
-       }
-       tmp = POLLOUT | POLLWRNORM;
-       if (ap->a_events & tmp) {
-               /* XXX should be fixed */       
-               revents |= tmp;
-       }
-       ap->a_events = revents;
-       return(0);
-}
 
 static struct filterops fw_read_filterops =
        { 1, NULL, fwfilt_detach, fwfilt_read };
index ec6ece6..e945a42 100644 (file)
@@ -427,11 +427,7 @@ fwmem_ioctl(struct dev_ioctl_args *ap)
        }
        return(err);
 }
-int
-fwmem_poll(struct dev_poll_args *ap)
-{  
-       return EINVAL;
-}
+
 int
 fwmem_mmap(struct dev_mmap_args *ap)
 {  
index b7945da..d836fb6 100644 (file)
@@ -53,6 +53,5 @@ d_close_t     fwmem_close;
 d_ioctl_t      fwmem_ioctl;
 d_read_t       fwmem_read;
 d_write_t      fwmem_write;
-d_poll_t       fwmem_poll;
 d_mmap_t       fwmem_mmap;
 d_strategy_t   fwmem_strategy;
index ac6418d..35f3b74 100644 (file)
@@ -69,7 +69,6 @@
 #include <sys/proc.h>
 #include <sys/conf.h>
 #include <sys/device.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/select.h>
 #include <sys/vnode.h>
@@ -148,7 +147,6 @@ d_open_t  usbopen;
 d_close_t usbclose;
 d_read_t usbread;
 d_ioctl_t usbioctl;
-d_poll_t usbpoll;
 d_kqfilter_t usbkqfilter;
 
 static void usbfilt_detach(struct knote *);
@@ -160,7 +158,6 @@ struct dev_ops usb_ops = {
        .d_close =      usbclose,
        .d_read =       usbread,
        .d_ioctl =      usbioctl,
-       .d_poll =       usbpoll,
        .d_kqfilter =   usbkqfilter
 };
 
@@ -699,31 +696,6 @@ usbioctl(struct dev_ioctl_args *ap)
        return (0);
 }
 
-int
-usbpoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       int revents, mask;
-       int unit = USBUNIT(dev);
-
-       if (unit == USB_DEV_MINOR) {
-               revents = 0;
-               mask = POLLIN | POLLRDNORM;
-
-               crit_enter();
-               if (ap->a_events & mask && usb_nevents > 0)
-                       revents |= ap->a_events & mask;
-               if (revents == 0 && ap->a_events & mask)
-                       selrecord(curthread, &usb_selevent);
-               crit_exit();
-               ap->a_events = revents;
-               return (0);
-       } else {
-               ap->a_events = 0;
-               return (0);     /* select/poll never wakes up - back compat */
-       }
-}
-
 static struct filterops usbfiltops =
        { 1, NULL, usbfilt_detach, usbfilt };
 
index 2ead778..59d1c45 100644 (file)
@@ -56,7 +56,6 @@ struct drm_file;
 #include <sys/sysctl.h>
 #include <sys/bus.h>
 #include <sys/signalvar.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/tree.h>
 #include <sys/taskqueue.h>
@@ -731,7 +730,6 @@ d_ioctl_t drm_ioctl;
 d_open_t drm_open;
 d_close_t drm_close;
 d_read_t drm_read;
-d_poll_t drm_poll;
 d_kqfilter_t drm_kqfilter;
 d_mmap_t drm_mmap;
 extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
index 12f79ab..b05f1ce 100644 (file)
@@ -124,7 +124,6 @@ static struct dev_ops drm_cdevsw = {
        .d_close =      drm_close,
        .d_read =       drm_read,
        .d_ioctl =      drm_ioctl,
-       .d_poll =       drm_poll,
        .d_kqfilter =   drm_kqfilter,
        .d_mmap =       drm_mmap
 };
index e814192..af87270 100644 (file)
@@ -109,11 +109,6 @@ int drm_read(struct dev_read_args *ap)
        return 0;
 }
 
-int drm_poll(struct dev_poll_args *ap)
-{
-       return 0;
-}
-
 static int
 drmfilt(struct knote *kn, long hint)
 {
index 706f589..16e138a 100644 (file)
@@ -44,7 +44,6 @@
 #include <sys/kernel.h>
 #include <sys/sockio.h>
 #include <sys/mbuf.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/conf.h>
 #include <sys/fcntl.h>
@@ -131,7 +130,6 @@ static d_open_t             cmx_open;
 static d_close_t       cmx_close;
 static d_read_t                cmx_read;
 static d_write_t       cmx_write;
-static d_poll_t                cmx_poll;
 static d_kqfilter_t    cmx_kqfilter;
 #ifdef CMX_INTR
 static void            cmx_intr(void *arg);
@@ -148,7 +146,6 @@ static struct dev_ops cmx_ops = {
        .d_close =      cmx_close,
        .d_read =       cmx_read,
        .d_write =      cmx_write,
-       .d_poll =       cmx_poll,
        .d_kqfilter =   cmx_kqfilter
 };
 
@@ -649,51 +646,6 @@ cmx_write(struct dev_write_args *ap)
        return 0;
 }
 
-/*
- * Poll handler.  Writing is always possible, reading is only possible
- * if BSR_BULK_IN_FULL is set.  Will start the cmx_tick callout and
- * set sc->polling.
- */
-static int
-cmx_poll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       struct cmx_softc *sc;
-       int revents = 0;
-       uint8_t bsr = 0;
-
-       sc = devclass_get_softc(cmx_devclass, minor(dev));
-       if (sc == NULL || sc->dying)
-               return ENXIO;
-
-       bsr = cmx_read_BSR(sc);
-       DEBUG_printf(sc->dev, "called (events=%b BSR=%b)\n",
-                       ap->a_events, POLLBITS, bsr, BSRBITS);
-
-       revents = ap->a_events & (POLLOUT | POLLWRNORM);
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (cmx_test(bsr, BSR_BULK_IN_FULL, 1)) {
-                       revents |= ap->a_events & (POLLIN | POLLRDNORM);
-               } else {
-                       selrecord(curthread, &sc->sel);
-                       CMX_LOCK(sc);
-                       if (!sc->polling) {
-                               DEBUG_printf(sc->dev, "enabling polling\n");
-                               sc->polling = 1;
-                               callout_reset(&sc->ch, POLL_TICKS,
-                                               cmx_tick, sc);
-                       } else {
-                               DEBUG_printf(sc->dev, "already polling\n");
-                       }
-                       CMX_UNLOCK(sc);
-               }
-       }
-
-       DEBUG_printf(sc->dev, "success (revents=%b)\n", revents, POLLBITS);
-
-       return revents;
-}
-
 static struct filterops cmx_read_filterops =
        { 1, NULL, cmx_filter_detach, cmx_filter_read };
 static struct filterops cmx_write_filterops =
index 25e24e5..194902f 100644 (file)
@@ -100,7 +100,6 @@ static struct dev_ops dcons_ops = {
        .d_read =       ttyread,
        .d_write =      ttywrite,
        .d_ioctl =      dcons_ioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
index a824ded..043e92f 100644 (file)
@@ -28,7 +28,6 @@
 #include <sys/device.h>
 #include <sys/lock.h>
 #include <sys/selinfo.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/uio.h>
 #include <sys/thread.h>
@@ -42,7 +41,6 @@
 static d_open_t                hotplugopen;
 static d_close_t       hotplugclose;
 static d_read_t                hotplugread;
-static d_poll_t                hotplugpoll;
 static d_kqfilter_t    hotplugkqfilter;
 
 static void hotplugfiltdetach(struct knote *);
@@ -53,7 +51,6 @@ static struct dev_ops hotplug_ops = {
        .d_open =       hotplugopen,
        .d_close =      hotplugclose,
        .d_read =       hotplugread,
-       .d_poll =       hotplugpoll,
        .d_kqfilter =   hotplugkqfilter
 };
 
@@ -107,24 +104,6 @@ hotplugclose(struct dev_close_args *ap)
        return 0;
 }
 
-static int
-hotplugpoll(struct dev_poll_args *ap)
-{
-       int     revents = 0;
-
-       lockmgr(&hpsc.lock, LK_EXCLUSIVE);
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (!TAILQ_EMPTY(&hpsc.queue))
-                       revents = ap->a_events & (POLLIN | POLLRDNORM);
-               else
-                       selrecord(curthread, &hpsc.sel);
-       }
-       lockmgr(&hpsc.lock, LK_RELEASE);
-
-       ap->a_events = revents;
-       return (0);
-}
-
 static struct filterops hotplugfiltops =
        { 1, NULL, hotplugfiltdetach, hotplugfilt };
 
index 6e18848..1d86f1f 100644 (file)
@@ -44,7 +44,6 @@
 #include <sys/conf.h>
 #include <sys/proc.h>
 #include <sys/tty.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/vnode.h>
 #include <sys/uio.h>
@@ -495,7 +494,6 @@ static d_close_t    genkbdclose;
 static d_read_t                genkbdread;
 static d_write_t       genkbdwrite;
 static d_ioctl_t       genkbdioctl;
-static d_poll_t                genkbdpoll;
 static d_kqfilter_t    genkbdkqfilter;
 
 static void genkbdfiltdetach(struct knote *);
@@ -510,7 +508,6 @@ static struct dev_ops kbd_ops = {
        .d_read =       genkbdread,
        .d_write =      genkbdwrite,
        .d_ioctl =      genkbdioctl,
-       .d_poll =       genkbdpoll,
        .d_kqfilter =   genkbdkqfilter
 };
 
@@ -748,31 +745,6 @@ genkbdioctl(struct dev_ioctl_args *ap)
        return error;
 }
 
-static int
-genkbdpoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       keyboard_t *kbd;
-       genkbd_softc_t sc;
-       int revents;
-
-       revents = 0;
-       crit_enter();
-       sc = dev->si_drv1;
-       kbd = kbd_get_keyboard(KBD_INDEX(dev));
-       if ((sc == NULL) || (kbd == NULL) || !KBD_IS_VALID(kbd)) {
-               revents =  POLLHUP;     /* the keyboard has gone */
-       } else if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (sc->gkb_q_length > 0)
-                       revents = ap->a_events & (POLLIN | POLLRDNORM);
-               else
-                       selrecord(curthread, &sc->gkb_rsel);
-       }
-       crit_exit();
-       ap->a_events = revents;
-       return (0);
-}
-
 static struct filterops genkbdfiltops =
        { 1, NULL, genkbdfiltdetach, genkbdfilter };
 
index 27ee023..3d660dd 100644 (file)
@@ -51,7 +51,6 @@
 #include <sys/device.h>
 #include <sys/kernel.h>
 #include <sys/bus.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/selinfo.h>
 #include <sys/uio.h>
@@ -135,7 +134,6 @@ static      d_open_t        mseopen;
 static d_close_t       mseclose;
 static d_read_t        mseread;
 static  d_ioctl_t      mseioctl;
-static d_poll_t        msepoll;
 static d_kqfilter_t    msekqfilter;
 
 static void msefilter_detach(struct knote *);
@@ -148,7 +146,6 @@ static struct dev_ops mse_ops = {
        .d_close =      mseclose,
        .d_read =       mseread,
        .d_ioctl =      mseioctl,
-       .d_poll =       msepoll,
        .d_kqfilter =   msekqfilter
 };
 
@@ -611,35 +608,6 @@ mseioctl(struct dev_ioctl_args *ap)
        return (err);
 }
 
-/*
- * msepoll: check for mouse input to be processed.
- */
-static int
-msepoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev));
-       int revents = 0;
-
-       crit_enter();
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (sc->sc_bytesread != sc->mode.packetsize ||
-                   sc->sc_deltax != 0 || sc->sc_deltay != 0 ||
-                   (sc->sc_obuttons ^ sc->sc_buttons) != 0)
-                       revents |= ap->a_events & (POLLIN | POLLRDNORM);
-               else {
-                       /*
-                        * Since this is an exclusive open device, any previous
-                        * proc pointer is trash now, so we can just assign it.
-                        */
-                       selrecord(curthread, &sc->sc_selp);
-               }
-       }
-       crit_exit();
-       ap->a_events = revents;
-       return (0);
-}
-
 static struct filterops msefiltops =
        { 1, NULL, msefilter_detach, msefilter };
 
index bd40c45..7bd4375 100644 (file)
@@ -49,7 +49,6 @@
 #include <sys/tty.h>
 #include <sys/conf.h>
 #include <sys/fcntl.h>
-#include <sys/poll.h>
 #include <sys/kernel.h>
 #include <sys/vnode.h>
 #include <sys/signalvar.h>
@@ -76,7 +75,6 @@ static struct dev_ops nmdm_ops = {
        .d_read =       nmdmread,
        .d_write =      nmdmwrite,
        .d_ioctl =      nmdmioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
index 8a7b335..3e69ec6 100644 (file)
@@ -71,7 +71,6 @@
 #include <sys/bus.h>
 #include <sys/conf.h>
 #include <sys/device.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/syslog.h>
 #include <sys/malloc.h>
@@ -242,7 +241,6 @@ static d_open_t psmopen;
 static d_close_t psmclose;
 static d_read_t psmread;
 static d_ioctl_t psmioctl;
-static d_poll_t psmpoll;
 static d_kqfilter_t psmkqfilter;
 
 static int enable_aux_dev (KBDC);
@@ -351,7 +349,6 @@ static struct dev_ops psm_ops = {
        .d_close =      psmclose,
        .d_read =       psmread,
        .d_ioctl =      psmioctl,
-       .d_poll =       psmpoll,
        .d_kqfilter =   psmkqfilter
 };
 
@@ -2384,26 +2381,6 @@ psmintr(void *arg)
     }
 }
 
-static int
-psmpoll(struct dev_poll_args *ap)
-{
-    cdev_t dev = ap->a_head.a_dev;
-    struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev));
-    int revents = 0;
-
-    /* Return true if a mouse event available */
-    crit_enter();
-    if (ap->a_events & (POLLIN | POLLRDNORM)) {
-       if (sc->queue.count > 0)
-           revents |= ap->a_events & (POLLIN | POLLRDNORM);
-       else
-           selrecord(curthread, &sc->rsel);
-    }
-    crit_exit();
-    ap->a_events = revents;
-    return (0);
-}
-
 static struct filterops psmfiltops =
        { 1, NULL, psmfilter_detach, psmfilter };
 
index 1086c0d..de5487a 100644 (file)
@@ -23,7 +23,6 @@
 #include <sys/malloc.h>
 #include <sys/tty.h>
 #include <sys/conf.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/kernel.h>
 #include <sys/queue.h>
@@ -40,13 +39,13 @@ static      d_close_t       snpclose;
 static d_read_t        snpread;
 static d_write_t       snpwrite;
 static d_ioctl_t       snpioctl;
-static d_poll_t        snppoll;
 static d_kqfilter_t    snpkqfilter;
 static d_clone_t       snpclone;
 DEVFS_DECLARE_CLONE_BITMAP(snp);
 
 static void snpfilter_detach(struct knote *);
-static int snpfilter(struct knote *, long);
+static int snpfilter_rd(struct knote *, long);
+static int snpfilter_wr(struct knote *, long);
 
 #if NSNP <= 1
 #define SNP_PREALLOCATED_UNITS 4
@@ -62,7 +61,6 @@ static struct dev_ops snp_ops = {
        .d_read =       snpread,
        .d_write =      snpwrite,
        .d_ioctl =      snpioctl,
-       .d_poll =       snppoll,
        .d_kqfilter =   snpkqfilter
 };
 
@@ -564,32 +562,10 @@ snpioctl(struct dev_ioctl_args *ap)
        return (0);
 }
 
-static int
-snppoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       struct snoop *snp;
-       int revents;
-
-       snp = dev->si_drv1;
-       revents = 0;
-       /*
-        * If snoop is down, we don't want to poll() forever so we return 1.
-        * Caller should see if we down via FIONREAD ioctl().  The last should
-        * return -1 to indicate down state.
-        */
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (snp->snp_flags & SNOOP_DOWN || snp->snp_len > 0)
-                       revents |= ap->a_events & (POLLIN | POLLRDNORM);
-               else
-                       selrecord(curthread, &snp->snp_sel);
-       }
-       ap->a_events = revents;
-       return (0);
-}
-
-static struct filterops snpfiltops =
-        { 1, NULL, snpfilter_detach, snpfilter };
+static struct filterops snpfiltops_rd =
+        { 1, NULL, snpfilter_detach, snpfilter_rd };
+static struct filterops snpfiltops_wr =
+        { 1, NULL, snpfilter_detach, snpfilter_wr };
 
 static int
 snpkqfilter(struct dev_kqfilter_args *ap)
@@ -603,7 +579,11 @@ snpkqfilter(struct dev_kqfilter_args *ap)
 
        switch (kn->kn_filter) {
        case EVFILT_READ:
-               kn->kn_fop = &snpfiltops;
+               kn->kn_fop = &snpfiltops_rd;
+               kn->kn_hook = (caddr_t)snp;
+               break;
+       case EVFILT_WRITE:
+               kn->kn_fop = &snpfiltops_wr;
                kn->kn_hook = (caddr_t)snp;
                break;
        default:
@@ -632,7 +612,7 @@ snpfilter_detach(struct knote *kn)
 }
 
 static int
-snpfilter(struct knote *kn, long hint)
+snpfilter_rd(struct knote *kn, long hint)
 {
        struct snoop *snp = (struct snoop *)kn->kn_hook;
        int ready = 0;
@@ -649,6 +629,13 @@ snpfilter(struct knote *kn, long hint)
 }
 
 static int
+snpfilter_wr(struct knote *kn, long hint)
+{
+       /* Writing is always OK */
+       return (1);
+}
+
+static int
 snpclone(struct dev_clone_args *ap)
 {
        int unit;
index dcef981..40d5516 100644 (file)
@@ -56,7 +56,6 @@
 #include <sys/kernel.h>
 #include <sys/bus.h>
 #include <sys/rman.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/tty.h>
 #include <sys/conf.h>
@@ -86,7 +85,6 @@ static d_open_t               spicopen;
 static d_close_t       spicclose;
 static d_read_t                spicread;
 static d_ioctl_t       spicioctl;
-static d_poll_t                spicpoll;
 static d_kqfilter_t    spickqfilter;
 
 static void spicfilt_detach(struct knote *);
@@ -98,7 +96,6 @@ static struct dev_ops spic_ops = {
         .d_close =     spicclose,
         .d_read =      spicread,
         .d_ioctl =     spicioctl,
-        .d_poll =      spicpoll,
        .d_kqfilter =   spickqfilter
 };
 
@@ -524,26 +521,6 @@ spicioctl(struct dev_ioctl_args *ap)
        return EIO;
 }
 
-static int
-spicpoll(struct dev_poll_args *ap)
-{
-       struct spic_softc *sc;
-       int revents = 0;
-
-       sc = devclass_get_softc(spic_devclass, 0);
-       crit_enter();
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (sc->sc_count) {
-                       revents |= ap->a_events & (POLLIN | POLLRDNORM);
-               } else {
-                       selrecord(curthread, &sc->sc_rsel);
-               }
-       }
-       crit_exit();
-       ap->a_events = revents;
-       return(0);
-}
-
 static struct filterops spicfiltops =
        { 1, NULL, spicfilt_detach, spicfilt };
 
index 43cbb5d..3f2b330 100644 (file)
@@ -240,7 +240,6 @@ static struct dev_ops sc_ops = {
        .d_read =       scread,
        .d_write =      ttywrite,
        .d_ioctl =      scioctl,
-       .d_poll =       ttypoll,
        .d_mmap =       scmmap,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
index e0fb193..954f7f1 100644 (file)
@@ -58,7 +58,6 @@ static struct dev_ops sm_ops = {
        .d_close =      smclose,
        .d_read =       ttyread,
        .d_ioctl =      smioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
index 0f622fd..12a1915 100644 (file)
 #include <sys/uio.h>
 #include <sys/syslog.h>
 #include <sys/selinfo.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/thread2.h>
 
@@ -215,11 +214,11 @@ static    d_open_t        twopen;
 static d_close_t       twclose;
 static d_read_t        twread;
 static d_write_t       twwrite;
-static d_poll_t        twpoll;
 static d_kqfilter_t    twkqfilter;
 
 static void twfilter_detach(struct knote *);
-static int twfilter(struct knote *, long);
+static int twfilter_read(struct knote *, long);
+static int twfilter_write(struct knote *, long);
 
 #define CDEV_MAJOR 19
 static struct dev_ops tw_ops = {
@@ -228,7 +227,6 @@ static struct dev_ops tw_ops = {
        .d_close =      twclose,
        .d_read =       twread,
        .d_write =      twwrite,
-       .d_poll =       twpoll,
        .d_kqfilter =   twkqfilter
 };
 
@@ -527,29 +525,10 @@ twwrite(struct dev_write_args *ap)
  * Determine if there is data available for reading
  */
 
-int
-twpoll(struct dev_poll_args *ap)
-{
-  cdev_t dev = ap->a_head.a_dev;
-  struct tw_sc *sc;
-  int revents = 0;
-
-  sc = &tw_sc[TWUNIT(dev)];
-  crit_enter();
-  /* XXX is this correct?  the original code didn't test select rw mode!! */
-  if (ap->a_events & (POLLIN | POLLRDNORM)) {
-    if(sc->sc_nextin != sc->sc_nextout)
-      revents |= ap->a_events & (POLLIN | POLLRDNORM);
-    else
-      selrecord(curthread, &sc->sc_selp);
-  }
-  crit_exit();
-  ap->a_events = revents;
-  return(0);
-}
-
-static struct filterops twfiltops =
-       { 1, NULL, twfilter_detach, twfilter };
+static struct filterops twfiltops_read =
+       { 1, NULL, twfilter_detach, twfilter_read };
+static struct filterops twfiltops_write =
+       { 1, NULL, twfilter_detach, twfilter_write };
 
 static int
 twkqfilter(struct dev_kqfilter_args *ap)
@@ -564,7 +543,12 @@ twkqfilter(struct dev_kqfilter_args *ap)
   switch (kn->kn_filter) {
   case EVFILT_READ:
     sc = &tw_sc[TWUNIT(dev)];
-    kn->kn_fop = &twfiltops;
+    kn->kn_fop = &twfiltops_read;
+    kn->kn_hook = (caddr_t)sc;
+    break;
+  case EVFILT_WRITE:
+    sc = &tw_sc[TWUNIT(dev)];
+    kn->kn_fop = &twfiltops_write;
     kn->kn_hook = (caddr_t)sc;
     break;
   default:
@@ -593,7 +577,7 @@ twfilter_detach(struct knote *kn)
 }
 
 static int
-twfilter(struct knote *kn, long hint)
+twfilter_read(struct knote *kn, long hint)
 {
   struct tw_sc *sc = (struct tw_sc *)kn->kn_hook;
   int ready = 0;
@@ -606,6 +590,13 @@ twfilter(struct knote *kn, long hint)
   return (ready);
 }
 
+static int
+twfilter_write(struct knote *kn, long hint)
+{
+  /* write() is always OK */
+  return (1);
+}
+
 /*
  * X-10 Protocol
  */
index aca4e6b..bc4bd1b 100644 (file)
@@ -45,7 +45,6 @@
 #include <sys/kernel.h>
 #include <sys/kthread.h>
 #include <sys/sysctl.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 
 #include <sys/bus.h>
@@ -213,7 +212,6 @@ static char *aac_describe_code(struct aac_code_lookup *table,
 static d_open_t                aac_open;
 static d_close_t       aac_close;
 static d_ioctl_t       aac_ioctl;
-static d_poll_t                aac_poll;
 static d_kqfilter_t    aac_kqfilter;
 static void            aac_filter_detach(struct knote *kn);
 static int             aac_filter(struct knote *kn, long hint);
@@ -235,7 +233,6 @@ static struct dev_ops aac_ops = {
        .d_open =       aac_open,
        .d_close =      aac_close,
        .d_ioctl =      aac_ioctl,
-       .d_poll =       aac_poll,
        .d_kqfilter =   aac_kqfilter
 };
 
@@ -3064,31 +3061,6 @@ aac_ioctl(struct dev_ioctl_args *ap)
        return(error);
 }
 
-static int
-aac_poll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       struct aac_softc *sc;
-       int revents;
-
-       sc = dev->si_drv1;
-       revents = 0;
-
-       AAC_LOCK_ACQUIRE(&sc->aac_aifq_lock);
-       if ((ap->a_events & (POLLRDNORM | POLLIN)) != 0) {
-               if (sc->aac_aifq_tail != sc->aac_aifq_head)
-                       revents |= ap->a_events & (POLLIN | POLLRDNORM);
-       }
-       AAC_LOCK_RELEASE(&sc->aac_aifq_lock);
-
-       if (revents == 0) {
-               if (ap->a_events & (POLLIN | POLLRDNORM))
-                       selrecord(curthread, &sc->rcv_select);
-       }
-       ap->a_events = revents;
-       return (0);
-}
-
 static struct filterops aac_filterops =
        { 1, NULL, aac_filter_detach, aac_filter };
 
index 7ea66e2..b4f5b27 100644 (file)
@@ -45,7 +45,7 @@
 #include "vinumhdr.h"
 #include <sys/sysproto.h>                                  /* for sync(2) */
 #include <sys/devicestat.h>
-#include <sys/poll.h>
+#include <sys/poll.h>                                      /* XXX: poll ops used in kq filters */
 #include <sys/event.h>
 #ifdef VINUMDEBUG
 #include <sys/reboot.h>
@@ -64,7 +64,6 @@ struct dev_ops vinum_ops =
        .d_read =       physread,
        .d_write =      physwrite,
        .d_ioctl =      vinumioctl,
-       .d_poll =       vinumpoll,
        .d_kqfilter =   vinumkqfilter,
        .d_strategy =   vinumstrategy,
        .d_dump =       vinumdump,
@@ -575,18 +574,11 @@ vinumdump(struct dev_dump_args *ap)
     return ENXIO;
 }
 
-int
-vinumpoll(struct dev_poll_args *ap)
-{
-    ap->a_events = seltrue(ap->a_head.a_dev, ap->a_events);
-    return(0);
-}
-
 void
 vinumfilt_detach(struct knote *kn) {}
 
 int
-vinumfilt(struct knote *kn, long hint)
+vinumfilt_rd(struct knote *kn, long hint)
 {
     cdev_t dev = (cdev_t)kn->kn_hook;
 
@@ -596,16 +588,28 @@ vinumfilt(struct knote *kn, long hint)
     return (0);
 }
 
-struct filterops vinumfiltops =
-    { 1, NULL, vinumfilt_detach, vinumfilt };
+int
+vinumfilt_wr(struct knote *kn, long hint)
+{
+    /* Writing is always OK */
+    return (1);
+}
+
+struct filterops vinumfiltops_rd =
+    { 1, NULL, vinumfilt_detach, vinumfilt_rd };
+struct filterops vinumfiltops_wr =
+    { 1, NULL, vinumfilt_detach, vinumfilt_wr };
 
 int
 vinumkqfilter(struct dev_kqfilter_args *ap)
 {
     if (ap->a_kn->kn_filter == EVFILT_READ) {
-        ap->a_kn->kn_fop = &vinumfiltops;
+        ap->a_kn->kn_fop = &vinumfiltops_rd;
         ap->a_kn->kn_hook = (caddr_t)ap->a_head.a_dev;
         ap->a_result = 0;
+    } else if (ap->a_kn->kn_filter == EVFILT_WRITE) {
+       ap->a_kn->kn_fop = &vinumfiltops_wr;
+        ap->a_result = 0;
     } else {
         ap->a_result = EOPNOTSUPP;
     }
index 687f7fc..ec8a5c5 100644 (file)
@@ -138,10 +138,10 @@ d_strategy_t vinumstrategy;
 d_ioctl_t vinumioctl;
 d_dump_t vinumdump;
 d_psize_t vinumsize;
-d_poll_t vinumpoll;
 d_kqfilter_t vinumkqfilter;
 
-int vinumfilt(struct knote *, long);
+int vinumfilt_rd(struct knote *, long);
+int vinumfilt_wr(struct knote *, long);
 void vinumfilt_detach(struct knote *);
 
 int vinumstart(cdev_t dev, struct bio *bio, int reviveok);
index 66a8774..218ee5f 100644 (file)
@@ -390,7 +390,6 @@ static struct dev_ops sio_ops = {
        .d_read =       ttyread,
        .d_write =      siowrite,
        .d_ioctl =      sioioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
index 97854d6..02b07e4 100644 (file)
@@ -248,7 +248,6 @@ static struct dev_ops dgm_ops = {
        .d_read =       ttyread,
        .d_write =      ttywrite,
        .d_ioctl =      dgmioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
index 998ac56..3dddc47 100644 (file)
@@ -153,7 +153,6 @@ static struct dev_ops digi_ops = {
        .d_read =       digiread,
        .d_write =      digiwrite,
        .d_ioctl =      digiioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
index bcc2bdd..58e452f 100644 (file)
@@ -98,7 +98,6 @@ static struct dev_ops rc_ops = {
        .d_read =       ttyread,
        .d_write =      ttywrite,
        .d_ioctl =      rcioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
index 4cee213..f095f9e 100644 (file)
@@ -578,7 +578,6 @@ struct dev_ops rp_ops = {
        .d_read =       ttyread,
        .d_write =      rpwrite,
        .d_ioctl =      rpioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
index dfc8e5e..c9c7317 100644 (file)
@@ -126,7 +126,6 @@ static struct dev_ops si_ops = {
        .d_read =       ttyread,
        .d_write =      siwrite,
        .d_ioctl =      siioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
index a40c01e..4865894 100644 (file)
@@ -257,7 +257,6 @@ static struct dev_ops sio_ops = {
        .d_read =       sioread,
        .d_write =      siowrite,
        .d_ioctl =      sioioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
index 3c19404..4fa3d6d 100644 (file)
@@ -756,7 +756,6 @@ static struct dev_ops stl_ops = {
        .d_read =       ttyread,
        .d_write =      ttywrite,
        .d_ioctl =      stlioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
index 8553f3e..ddde409 100644 (file)
@@ -639,7 +639,6 @@ static struct dev_ops stli_ops = {
        .d_read =       stliread,
        .d_write =      stliwrite,
        .d_ioctl =      stliioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
index 4eacd29..60da277 100644 (file)
@@ -43,7 +43,6 @@ static d_close_t dsp_close;
 static d_read_t dsp_read;
 static d_write_t dsp_write;
 static d_ioctl_t dsp_ioctl;
-static d_poll_t dsp_poll;
 static d_kqfilter_t dsp_kqfilter;
 static d_mmap_t dsp_mmap;
 
@@ -59,7 +58,6 @@ struct dev_ops dsp_cdevsw = {
        .d_read =       dsp_read,
        .d_write =      dsp_write,
        .d_ioctl =      dsp_ioctl,
-       .d_poll =       dsp_poll,
        .d_kqfilter =   dsp_kqfilter,
        .d_mmap =       dsp_mmap,
 };
@@ -1088,34 +1086,6 @@ dsp_ioctl(struct dev_ioctl_args *ap)
        return ret;
 }
 
-static int
-dsp_poll(struct dev_poll_args *ap)
-{
-       struct cdev *i_dev = ap->a_head.a_dev;
-       int events = ap->a_events;
-       struct thread *td = curthread;
-       struct pcm_channel *wrch = NULL, *rdch = NULL;
-       int ret, e;
-
-       ret = 0;
-       getchns(i_dev, &rdch, &wrch, SD_F_PRIO_RD | SD_F_PRIO_WR);
-
-       if (wrch) {
-               e = (events & (POLLOUT | POLLWRNORM));
-               if (e)
-                       ret |= chn_poll(wrch, e, td);
-       }
-       if (rdch) {
-               e = (events & (POLLIN | POLLRDNORM));
-               if (e)
-                       ret |= chn_poll(rdch, e, td);
-       }
-       relchns(i_dev, rdch, wrch, SD_F_PRIO_RD | SD_F_PRIO_WR);
-
-       ap->a_events = ret;
-       return (0);
-}
-
 static struct filterops dsp_read_filtops =
        { 1, NULL, dsp_filter_detach, dsp_filter_read };
 static struct filterops dsp_write_filtops =
index 3960296..3500f83 100644 (file)
@@ -80,7 +80,6 @@
 #include <sys/select.h>
 #include <sys/proc.h>
 #include <sys/priv.h>
-#include <sys/poll.h>
 #include <sys/sysctl.h>
 #include <sys/thread2.h>
 
@@ -127,7 +126,6 @@ static struct dev_ops ucom_ops = {
        .d_read =       ucomread,
        .d_write =      ucomwrite,
        .d_ioctl =      ucomioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
index 83f33cb..58f2d0e 100644 (file)
@@ -63,7 +63,6 @@
 #include <sys/file.h>
 #include <sys/select.h>
 #include <sys/vnode.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/sysctl.h>
 #include <sys/thread2.h>
@@ -140,7 +139,6 @@ d_close_t ugenclose;
 d_read_t  ugenread;
 d_write_t ugenwrite;
 d_ioctl_t ugenioctl;
-d_poll_t  ugenpoll;
 d_kqfilter_t ugenkqfilter;
 
 static void ugen_filt_detach(struct knote *);
@@ -156,7 +154,6 @@ static struct dev_ops ugen_ops = {
        .d_read =       ugenread,
        .d_write =      ugenwrite,
        .d_ioctl =      ugenioctl,
-       .d_poll =       ugenpoll,
        .d_kqfilter =   ugenkqfilter
 };
 
@@ -1429,85 +1426,6 @@ ugenioctl(struct dev_ioctl_args *ap)
        return (error);
 }
 
-int
-ugenpoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       struct ugen_softc *sc;
-       struct ugen_endpoint *sce_in, *sce_out;
-       usb_endpoint_descriptor_t *edesc;
-       int revents = 0;
-
-       sc = devclass_get_softc(ugen_devclass, UGENUNIT(dev));
-
-       if (sc->sc_dying) {
-               return ((ap->a_events & (POLLIN | POLLOUT | POLLRDNORM |
-                       POLLWRNORM)) | POLLHUP);
-       }
-
-       /* Do not allow to poll a control endpoint */
-       if (UGENENDPOINT(dev) == USB_CONTROL_ENDPOINT) {
-               return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM |
-                       POLLWRNORM));
-       }
-
-       sce_in = &sc->sc_endpoints[UGENENDPOINT(dev)][IN];
-       sce_out = &sc->sc_endpoints[UGENENDPOINT(dev)][OUT];
-       edesc = (sce_in->edesc != NULL) ? sce_in->edesc : sce_out->edesc;
-       KASSERT(edesc != NULL, ("ugenpoll: NULL edesc"));
-
-       if (sce_in->edesc == NULL || sce_in->pipeh == NULL)
-               sce_in = NULL;
-       if (sce_out->edesc == NULL || sce_out->pipeh == NULL)
-               sce_out = NULL;
-
-       crit_enter();
-       switch (edesc->bmAttributes & UE_XFERTYPE) {
-       case UE_INTERRUPT:
-               if (sce_in != NULL && (ap->a_events & (POLLIN | POLLRDNORM))) {
-                       if (sce_in->q.c_cc > 0)
-                               revents |= ap->a_events & (POLLIN | POLLRDNORM);
-                       else
-                               selrecord(curthread, &sce_in->rsel);
-               }
-               if (sce_out != NULL && (ap->a_events & (POLLOUT | POLLWRNORM))) {
-                       if (sce_out->q.c_cc > 0)
-                               revents |= ap->a_events & (POLLOUT | POLLWRNORM);
-                       else
-                               selrecord(curthread, &sce_out->rsel);
-               }
-               break;
-       case UE_ISOCHRONOUS:
-               if (sce_in != NULL && (ap->a_events & (POLLIN | POLLRDNORM))) {
-                       if (sce_in->cur != sce_in->fill)
-                               revents |= ap->a_events & (POLLIN | POLLRDNORM);
-                       else
-                               selrecord(curthread, &sce_in->rsel);
-               }
-               if (sce_out != NULL && (ap->a_events & (POLLOUT | POLLWRNORM))) {
-                       if (sce_out->cur != sce_out->fill)
-                               revents |= ap->a_events & (POLLOUT | POLLWRNORM);
-                       else
-                               selrecord(curthread, &sce_out->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 |= ap->a_events &
-                          (POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM);
-               break;
-       default:
-               break;
-       }
-       crit_exit();
-       ap->a_events = revents;
-       return (0);
-}
-
 static struct filterops ugen_filtops_read =
        { 1, NULL, ugen_filt_detach, ugen_filt_read };
 static struct filterops ugen_filtops_write =
index 367c792..16243e8 100644 (file)
@@ -63,7 +63,6 @@
 #include <sys/select.h>
 #include <sys/proc.h>
 #include <sys/vnode.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/sysctl.h>
 #include <sys/thread2.h>
@@ -132,7 +131,6 @@ d_close_t   uhidclose;
 d_read_t       uhidread;
 d_write_t      uhidwrite;
 d_ioctl_t      uhidioctl;
-d_poll_t       uhidpoll;
 d_kqfilter_t   uhidkqfilter;
 
 static void uhidfilt_detach(struct knote *);
@@ -148,7 +146,6 @@ static struct dev_ops uhid_ops = {
        .d_read =       uhidread,
        .d_write =      uhidwrite,
        .d_ioctl =      uhidioctl,
-       .d_poll =       uhidpoll,
        .d_kqfilter =   uhidkqfilter
 };
 
@@ -672,32 +669,6 @@ uhidioctl(struct dev_ioctl_args *ap)
        return (error);
 }
 
-int
-uhidpoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       struct uhid_softc *sc;
-       int revents = 0;
-
-       sc = devclass_get_softc(uhid_devclass, UHIDUNIT(dev));
-
-       if (sc->sc_dying)
-               return (EIO);
-
-       crit_enter();
-       if (ap->a_events & (POLLOUT | POLLWRNORM))
-               revents |= ap->a_events & (POLLOUT | POLLWRNORM);
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (sc->sc_q.c_cc > 0)
-                       revents |= ap->a_events & (POLLIN | POLLRDNORM);
-               else
-                       selrecord(curthread, &sc->sc_rsel);
-       }
-       crit_exit();
-       ap->a_events = revents;
-       return (0);
-}
-
 static struct filterops uhidfiltops_read =
        { 1, NULL, uhidfilt_detach, uhidfilt_read };
 static struct filterops uhidfiltops_write =
index 92fdc7e..193041b 100644 (file)
@@ -55,7 +55,6 @@
 #include <sys/file.h>
 #include <sys/select.h>
 #include <sys/vnode.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/sysctl.h>
 #include <sys/thread2.h>
@@ -140,7 +139,6 @@ static d_open_t  ums_open;
 static d_close_t ums_close;
 static d_read_t  ums_read;
 static d_ioctl_t ums_ioctl;
-static d_poll_t  ums_poll;
 static d_kqfilter_t ums_kqfilter;
 
 static void ums_filt_detach(struct knote *);
@@ -154,7 +152,6 @@ static struct dev_ops ums_ops = {
        .d_close =      ums_close,
        .d_read =       ums_read,
        .d_ioctl =      ums_ioctl,
-       .d_poll =       ums_poll,
        .d_kqfilter =   ums_kqfilter
 };
 
@@ -671,34 +668,6 @@ ums_read(struct dev_read_args *ap)
        return 0;
 }
 
-static int
-ums_poll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       struct ums_softc *sc;
-       int revents = 0;
-
-       sc = devclass_get_softc(ums_devclass, UMSUNIT(dev));
-
-       if (!sc) {
-               ap->a_events = 0;
-               return 0;
-       }
-
-       crit_enter();
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (sc->qcount) {
-                       revents = ap->a_events & (POLLIN | POLLRDNORM);
-               } else {
-                       /* sc->state |= UMS_SELECT; */
-                       selrecord(curthread, &sc->rsel);
-               }
-       }
-       crit_exit();
-       ap->a_events = revents;
-       return (0);
-}
-
 static struct filterops ums_filtops =
        { 1, NULL, ums_filt_detach, ums_filt };
 
index f5179ba..0901ae6 100644 (file)
@@ -60,7 +60,6 @@
 #include <sys/file.h>
 #include <sys/select.h>
 #include <sys/proc.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/conf.h>
 #include <sys/sysctl.h>
@@ -255,7 +254,6 @@ d_open_t  uscanneropen;
 d_close_t uscannerclose;
 d_read_t  uscannerread;
 d_write_t uscannerwrite;
-d_poll_t  uscannerpoll;
 d_kqfilter_t uscannerkqfilter;
 
 #define USCANNER_CDEV_MAJOR    156
@@ -266,7 +264,6 @@ static struct dev_ops uscanner_ops = {
        .d_close =      uscannerclose,
        .d_read =       uscannerread,
        .d_write =      uscannerwrite,
-       .d_poll =       uscannerpoll,
        .d_kqfilter =   uscannerkqfilter
 };
 
@@ -648,30 +645,6 @@ uscanner_detach(device_t self)
        return (0);
 }
 
-int
-uscannerpoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       struct uscanner_softc *sc;
-       int revents = 0;
-
-       sc = devclass_get_softc(uscanner_devclass, USCANNERUNIT(dev));
-
-       if (sc->sc_dying)
-               return (EIO);
-
-       /*
-        * We have no easy way of determining if a read will
-        * yield any data or a write will happen.
-        * Pretend they will.
-        */
-       revents |= ap->a_events &
-                  (POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM);
-
-       ap->a_events = revents;
-       return (0);
-}
-
 static void
 uscannerfilt_detach(struct knote *kn) {}
 
index fe0ce82..9b7b290 100644 (file)
@@ -60,7 +60,6 @@
 #include <sys/signalvar.h>
 #include <sys/malloc.h>
 #include <sys/mman.h>
-#include <sys/poll.h>
 #include <sys/select.h>
 #include <sys/event.h>
 #include <sys/bus.h>
@@ -164,7 +163,6 @@ static      d_read_t        bktr_read;
 static d_write_t       bktr_write;
 static d_ioctl_t       bktr_ioctl;
 static d_mmap_t        bktr_mmap;
-static d_poll_t        bktr_poll;
 static d_kqfilter_t    bktr_kqfilter;
 
 static void bktr_filter_detach(struct knote *);
@@ -178,7 +176,6 @@ static struct dev_ops bktr_ops = {
        .d_read =       bktr_read,
        .d_write =      bktr_write,
        .d_ioctl =      bktr_ioctl,
-       .d_poll =       bktr_poll,
        .d_kqfilter =   bktr_kqfilter,
        .d_mmap =       bktr_mmap,
 };
@@ -724,45 +721,6 @@ bktr_mmap(struct dev_mmap_args *ap)
        return(0);
 }
 
-static int
-bktr_poll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       int             unit;
-       bktr_ptr_t      bktr;
-       int revents = 0; 
-
-       unit = UNIT(minor(dev));
-
-       /* Get the device data */
-       bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
-       if (bktr == NULL) {
-               /* the device is no longer valid/functioning */
-               return (ENXIO);
-       }
-
-       LOCK_VBI(bktr);
-       crit_enter();
-
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-
-               switch ( FUNCTION( minor(dev) ) ) {
-               case VBI_DEV:
-                       if(bktr->vbisize == 0)
-                               selrecord(curthread, &bktr->vbi_select);
-                       else
-                               revents |= ap->a_events & (POLLIN | POLLRDNORM);
-                       break;
-               }
-       }
-
-       crit_exit();
-       UNLOCK_VBI(bktr);
-
-       ap->a_events = revents;
-       return (0);
-}
-
 static struct filterops bktr_filterops =
        { 1, NULL, bktr_filter_detach, bktr_filter };
 
index ec3b8d3..cac3903 100644 (file)
@@ -45,7 +45,6 @@
 #include <sys/kernel.h>
 #include <sys/mman.h>
 #include <sys/module.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/proc.h>
 #include <sys/signalvar.h>
@@ -122,7 +121,6 @@ static      d_open_t        cxm_open;
 static d_close_t       cxm_close;
 static d_read_t        cxm_read;
 static d_ioctl_t       cxm_ioctl;
-static d_poll_t        cxm_poll;
 static d_kqfilter_t    cxm_kqfilter;
 
 static void cxm_filter_detach(struct knote *);
@@ -136,7 +134,6 @@ static struct dev_ops cxm_ops = {
        .d_close =      cxm_close,
        .d_read =       cxm_read,
        .d_ioctl =      cxm_ioctl,
-       .d_poll =       cxm_poll,
        .d_kqfilter =   cxm_kqfilter
 };
 
@@ -2910,38 +2907,6 @@ cxm_ioctl(struct dev_ioctl_args *ap)
        return 0;
 }
 
-
-int
-cxm_poll(struct dev_poll_args *ap)
-{
-       cdev_t          dev = ap->a_head.a_dev;
-       int             revents;
-       int             unit;
-       struct cxm_softc *sc;
-
-       unit = UNIT(minor(dev));
-
-       /* Get the device data */
-       sc = (struct cxm_softc*)devclass_get_softc(cxm_devclass, unit);
-       if (sc == NULL) {
-               /* the device is no longer valid/functioning */
-               return POLLHUP;
-       }
-
-       revents = 0;
-
-       crit_enter();
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (sc->enc_pool.read == sc->enc_pool.write)
-                       selrecord(curthread, &sc->enc_sel);
-               else
-                       revents = ap->a_events & (POLLIN | POLLRDNORM);
-       }
-       crit_exit();
-
-       return revents;
-}
-
 static struct filterops cxm_filterops =
        { 1, NULL, cxm_filter_detach, cxm_filter };
 
index 197622f..84105ab 100644 (file)
@@ -69,7 +69,6 @@ DEVOP_DESC_INIT(write);
 DEVOP_DESC_INIT(ioctl);
 DEVOP_DESC_INIT(dump);
 DEVOP_DESC_INIT(psize);
-DEVOP_DESC_INIT(poll);
 DEVOP_DESC_INIT(mmap);
 DEVOP_DESC_INIT(strategy);
 DEVOP_DESC_INIT(kqfilter);
@@ -89,7 +88,6 @@ struct dev_ops default_dev_ops = {
        .d_read = noread,
        .d_write = nowrite,
        .d_ioctl = noioctl,
-       .d_poll = nopoll,
        .d_mmap = nommap,
        .d_strategy = nostrategy,
        .d_dump = nodump,
@@ -176,21 +174,6 @@ dev_dioctl(cdev_t dev, u_long cmd, caddr_t data, int fflag, struct ucred *cred,
 }
 
 int
-dev_dpoll(cdev_t dev, int events)
-{
-       struct dev_poll_args ap;
-       int error;
-
-       ap.a_head.a_desc = &dev_poll_desc;
-       ap.a_head.a_dev = dev;
-       ap.a_events = events;
-       error = dev->si_ops->d_poll(&ap);
-       if (error == 0)
-               return(ap.a_events);
-       return (seltrue(dev, events));
-}
-
-int
 dev_dmmap(cdev_t dev, vm_offset_t offset, int nprot)
 {
        struct dev_mmap_args ap;
@@ -554,13 +537,6 @@ nommap(struct dev_mmap_args *ap)
 }
 
 int
-nopoll(struct dev_poll_args *ap)
-{
-       ap->a_events = 0;
-       return(0);
-}
-
-int
 nostrategy(struct dev_strategy_args *ap)
 {
        struct bio *bio = ap->a_bio;
index 8aa07c2..9c76b8a 100644 (file)
@@ -74,7 +74,6 @@ static        d_read_t        mmread;
 static d_write_t       mmwrite;
 static d_ioctl_t       mmioctl;
 static d_mmap_t        memmmap;
-static d_poll_t        mmpoll;
 static d_kqfilter_t    mmkqfilter;
 
 #define CDEV_MAJOR 2
@@ -85,7 +84,6 @@ static struct dev_ops mem_ops = {
        .d_read =       mmread,
        .d_write =      mmwrite,
        .d_ioctl =      mmioctl,
-       .d_poll =       mmpoll,
        .d_kqfilter =   mmkqfilter,
        .d_mmap =       memmmap,
 };
@@ -529,25 +527,6 @@ random_ioctl(cdev_t dev, u_long cmd, caddr_t data, int flags, struct ucred *cred
        return (error);
 }
 
-int
-mmpoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       int revents;
-
-       switch (minor(dev)) {
-       case 3:         /* /dev/random */
-               revents = random_poll(dev, ap->a_events);
-               break;
-       case 4:         /* /dev/urandom */
-       default:
-               revents = seltrue(dev, ap->a_events);
-               break;
-       }
-       ap->a_events = revents;
-       return (0);
-}
-
 static int
 mm_filter_read(struct knote *kn, long hint)
 {
index 3741f03..796ca26 100644 (file)
@@ -37,7 +37,6 @@
 #include <sys/proc.h>
 #include <sys/buf.h>
 #include <sys/conf.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/ioccom.h>
 #include <sys/malloc.h>
@@ -57,7 +56,6 @@ static cdev_t         udev_dev;
 static d_open_t                udev_dev_open;
 static d_close_t       udev_dev_close;
 static d_read_t                udev_dev_read;
-static d_poll_t                udev_dev_poll;
 static d_kqfilter_t    udev_dev_kqfilter;
 static d_ioctl_t       udev_dev_ioctl;
 
@@ -108,7 +106,6 @@ static struct dev_ops udev_dev_ops = {
        .d_open = udev_dev_open,
        .d_close = udev_dev_close,
        .d_read = udev_dev_read,
-       .d_poll = udev_dev_poll,
        .d_kqfilter = udev_dev_kqfilter,
        .d_ioctl = udev_dev_ioctl
 };
@@ -539,24 +536,6 @@ udev_dev_close(struct dev_close_args *ap)
        return 0;
 }
 
-static int
-udev_dev_poll(struct dev_poll_args *ap)
-{
-       int revents = 0;
-
-        lockmgr(&udevctx.lock, LK_EXCLUSIVE);
-        if (ap->a_events & (POLLIN | POLLRDNORM)) {
-                if (!TAILQ_EMPTY(&udevctx.ev_queue))
-                        revents = ap->a_events & (POLLIN | POLLRDNORM);
-                else
-                        selrecord(curthread, &udevctx.sel);
-        }
-        lockmgr(&udevctx.lock, LK_RELEASE);
-
-        ap->a_events = revents;
-        return 0;
-}
-
 static struct filterops udev_dev_read_filtops =
        { 1, NULL, udev_dev_filter_detach, udev_dev_filter_read };
 
index 3453b71..534b7aa 100644 (file)
@@ -46,7 +46,6 @@
 #include <sys/selinfo.h>
 #include <sys/uio.h>
 #include <sys/filio.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/signalvar.h>
 
@@ -143,7 +142,6 @@ static d_open_t             devopen;
 static d_close_t       devclose;
 static d_read_t                devread;
 static d_ioctl_t       devioctl;
-static d_poll_t                devpoll;
 static d_kqfilter_t    devkqfilter;
 
 static struct dev_ops devctl_ops = {
@@ -152,7 +150,6 @@ static struct dev_ops devctl_ops = {
        .d_close =      devclose,
        .d_read =       devread,
        .d_ioctl =      devioctl,
-       .d_poll =       devpoll,
        .d_kqfilter =   devkqfilter
 };
 
@@ -277,24 +274,6 @@ devioctl(struct dev_ioctl_args *ap)
        return (ENOTTY);
 }
 
-static int
-devpoll(struct dev_poll_args *ap)
-{
-       int     revents = 0;
-
-       lockmgr(&devsoftc.lock, LK_EXCLUSIVE);
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (!TAILQ_EMPTY(&devsoftc.devq))
-                       revents = ap->a_events & (POLLIN | POLLRDNORM);
-               else
-                       selrecord(curthread, &devsoftc.sel);
-       }
-       lockmgr(&devsoftc.lock, LK_RELEASE);
-
-       ap->a_events = revents;
-       return (0);
-}
-
 static void dev_filter_detach(struct knote *);
 static int dev_filter_read(struct knote *, long);
 
index 740e663..46ac56e 100644 (file)
@@ -50,7 +50,6 @@
 #include <sys/msgbuf.h>
 #include <sys/signalvar.h>
 #include <sys/kernel.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/filedesc.h>
 #include <sys/sysctl.h>
@@ -63,7 +62,6 @@ static        d_open_t        logopen;
 static d_close_t       logclose;
 static d_read_t        logread;
 static d_ioctl_t       logioctl;
-static d_poll_t        logpoll;
 static d_kqfilter_t    logkqfilter;
 
 static void logtimeout(void *arg);
@@ -77,7 +75,6 @@ static struct dev_ops log_ops = {
        .d_close =      logclose,
        .d_read =       logread,
        .d_ioctl =      logioctl,
-       .d_poll =       logpoll,
        .d_kqfilter =   logkqfilter
 };
 
@@ -165,24 +162,6 @@ logread(struct dev_read_args *ap)
        return (error);
 }
 
-/*ARGSUSED*/
-static int
-logpoll(struct dev_poll_args *ap)
-{
-       int revents = 0;
-
-       crit_enter();
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (msgbufp->msg_bufr != msgbufp->msg_bufx)
-                       revents |= ap->a_events & (POLLIN | POLLRDNORM);
-               else
-                       selrecord(curthread, &logsoftc.sc_selp);
-       }
-       crit_exit();
-       ap->a_events = revents;
-       return (0);
-}
-
 static struct filterops logread_filtops =
        { 1, NULL, logfiltdetach, logfiltread };
 
index 43e5525..0c8efa3 100644 (file)
@@ -86,7 +86,6 @@
 #include <sys/fcntl.h>
 #include <sys/conf.h>
 #include <sys/dkstat.h>
-#include <sys/poll.h>
 #include <sys/kernel.h>
 #include <sys/vnode.h>
 #include <sys/signalvar.h>
@@ -1157,42 +1156,6 @@ ttioctl(struct tty *tp, u_long cmd, void *data, int flag)
        return (0);
 }
 
-int
-ttypoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       int events = ap->a_events;
-       int revents = 0;
-       struct tty *tp;
-
-       tp = dev->si_tty;
-       /* XXX used to return ENXIO, but that means true! */
-       if (tp == NULL) {
-               ap->a_events = (events & (POLLIN | POLLOUT | POLLRDNORM |
-                               POLLWRNORM)) | POLLHUP;
-               return(0);
-       }
-
-       crit_enter();
-       if (events & (POLLIN | POLLRDNORM)) {
-               if (ttnread(tp) > 0 || ISSET(tp->t_state, TS_ZOMBIE))
-                       revents |= events & (POLLIN | POLLRDNORM);
-               else
-                       selrecord(curthread, &tp->t_rsel);
-       }
-       if (events & (POLLOUT | POLLWRNORM)) {
-               if ((tp->t_outq.c_cc <= tp->t_olowat &&
-                    ISSET(tp->t_state, TS_CONNECTED))
-                   || ISSET(tp->t_state, TS_ZOMBIE))
-                       revents |= events & (POLLOUT | POLLWRNORM);
-               else
-                       selrecord(curthread, &tp->t_wsel);
-       }
-       crit_exit();
-       ap->a_events = revents;
-       return (0);
-}
-
 static struct filterops ttyread_filtops =
        { 1, NULL, filt_ttyrdetach, filt_ttyread };
 static struct filterops ttywrite_filtops =
index f38fc9a..3c6c4dd 100644 (file)
@@ -66,7 +66,6 @@ static d_close_t cnclose;
 static d_read_t cnread;
 static d_write_t cnwrite;
 static d_ioctl_t cnioctl;
-static d_poll_t cnpoll;
 static d_kqfilter_t cnkqfilter;
 
 static int cnintercept(struct dev_generic_args *ap);
@@ -79,7 +78,6 @@ static struct dev_ops cn_ops = {
        .d_read =       cnread,
        .d_write =      cnwrite,
        .d_ioctl =      cnioctl,
-       .d_poll =       cnpoll,
        .d_kqfilter =   cnkqfilter,
 };
 
@@ -450,15 +448,6 @@ cnioctl(struct dev_ioctl_args *ap)
 }
 
 static int
-cnpoll(struct dev_poll_args *ap)
-{
-       if ((cn_tab == NULL) || cn_mute || cn_fwd_ops == NULL)
-               return (1);
-       ap->a_head.a_dev = cn_tab->cn_dev;
-       return (dev_doperate(&ap->a_head));
-}
-
-static int
 cnkqfilter(struct dev_kqfilter_args *ap)
 {
        if ((cn_tab == NULL) || cn_mute || cn_fwd_ops == NULL)
index 1661659..788f38a 100644 (file)
@@ -52,7 +52,6 @@
 #include <sys/tty.h>
 #include <sys/conf.h>
 #include <sys/fcntl.h>
-#include <sys/poll.h>
 #include <sys/kernel.h>
 #include <sys/vnode.h>
 #include <sys/signalvar.h>
@@ -85,7 +84,6 @@ static        d_open_t        ptcopen;
 static d_close_t       ptcclose;
 static d_read_t        ptcread;
 static d_write_t       ptcwrite;
-static d_poll_t        ptcpoll;
 static d_kqfilter_t    ptckqfilter;
 
 #ifdef UNIX98_PTYS
@@ -102,7 +100,6 @@ static struct dev_ops pts98_ops = {
        .d_read =       ptsread,
        .d_write =      ptswrite,
        .d_ioctl =      ptyioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
@@ -114,7 +111,6 @@ static struct dev_ops ptc98_ops = {
        .d_read =       ptcread,
        .d_write =      ptcwrite,
        .d_ioctl =      ptyioctl,
-       .d_poll =       ptcpoll,
        .d_kqfilter =   ptckqfilter,
        .d_revoke =     ttyrevoke
 };
@@ -128,7 +124,6 @@ static struct dev_ops pts_ops = {
        .d_read =       ptsread,
        .d_write =      ptswrite,
        .d_ioctl =      ptyioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
        .d_revoke =     ttyrevoke
 };
@@ -141,7 +136,6 @@ static struct dev_ops ptc_ops = {
        .d_read =       ptcread,
        .d_write =      ptcwrite,
        .d_ioctl =      ptyioctl,
-       .d_poll =       ptcpoll,
        .d_kqfilter =   ptckqfilter,
        .d_revoke =     ttyrevoke
 };
@@ -655,56 +649,6 @@ ptsstop(struct tty *tp, int flush)
        ptcwakeup(tp, flag);
 }
 
-static int
-ptcpoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       struct tty *tp = dev->si_tty;
-       struct pt_ioctl *pti = dev->si_drv1;
-       int revents = 0;
-
-       if ((tp->t_state & TS_CONNECTED) == 0) {
-               ap->a_events = seltrue(dev, ap->a_events) | POLLHUP;
-               return(0);
-       }
-
-       /*
-        * Need to block timeouts (ttrstart).
-        */
-       crit_enter();
-
-       if (ap->a_events & (POLLIN | POLLRDNORM))
-               if ((tp->t_state & TS_ISOPEN) &&
-                   ((tp->t_outq.c_cc && (tp->t_state & TS_TTSTOP) == 0) ||
-                    ((pti->pt_flags & PF_PKT) && pti->pt_send) ||
-                    ((pti->pt_flags & PF_UCNTL) && pti->pt_ucntl)))
-                       revents |= ap->a_events & (POLLIN | POLLRDNORM);
-
-       if (ap->a_events & (POLLOUT | POLLWRNORM))
-               if (tp->t_state & TS_ISOPEN &&
-                   ((pti->pt_flags & PF_REMOTE) ?
-                    (tp->t_canq.c_cc == 0) : 
-                    ((tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG - 2) ||
-                     (tp->t_canq.c_cc == 0 && (tp->t_lflag & ICANON)))))
-                       revents |= ap->a_events & (POLLOUT | POLLWRNORM);
-
-       if (ap->a_events & POLLHUP)
-               if ((tp->t_state & TS_CARR_ON) == 0)
-                       revents |= POLLHUP;
-
-       if (revents == 0) {
-               if (ap->a_events & (POLLIN | POLLRDNORM))
-                       selrecord(curthread, &pti->pt_selr);
-
-               if (ap->a_events & (POLLOUT | POLLWRNORM)) 
-                       selrecord(curthread, &pti->pt_selw);
-       }
-       crit_exit();
-
-       ap->a_events = revents;
-       return (0);
-}
-
 /*
  * kqueue ops for pseudo-terminals.
  */
index d3fe69e..ed28148 100644 (file)
 #include <sys/ttycom.h>
 #include <sys/vnode.h>
 #include <sys/kernel.h>
+#include <sys/poll.h> /* XXX: poll args used in KQ filters */
 #include <sys/event.h>
-#include <sys/poll.h>
 
 static d_open_t        cttyopen;
 static d_close_t       cttyclose;
 static d_read_t        cttyread;
 static d_write_t       cttywrite;
 static d_ioctl_t       cttyioctl;
-static d_poll_t        cttypoll;
 static d_kqfilter_t    cttykqfilter;
 
 static void cttyfilt_detach(struct knote *);
@@ -73,7 +72,6 @@ struct dev_ops ctty_ops = {
        .d_read =       cttyread,
        .d_write =      cttywrite,
        .d_ioctl =      cttyioctl,
-       .d_poll =       cttypoll,
        .d_kqfilter =   cttykqfilter
 };
 
@@ -242,26 +240,6 @@ cttyioctl(struct dev_ioctl_args *ap)
                          ap->a_cred, ap->a_sysmsg));
 }
 
-/*ARGSUSED*/
-static int
-cttypoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       struct vnode *ttyvp;
-       struct proc *p = curproc;
-
-       KKASSERT(p);
-       ttyvp = cttyvp(p);
-       /*
-        * try operation to get EOF/failure 
-        */
-       if (ttyvp == NULL)
-               ap->a_events = seltrue(dev, ap->a_events);
-       else
-               ap->a_events = VOP_POLL(ttyvp, ap->a_events, p->p_ucred);
-       return(0);
-}
-
 static struct filterops cttyfiltops_read =
        { 1, NULL, cttyfilt_detach, cttyfilt_read };
 static struct filterops cttyfiltops_write =
index d057e39..456ca3b 100644 (file)
@@ -57,7 +57,6 @@
 #include <sys/ttycom.h>
 #include <sys/filedesc.h>
 
-#include <sys/poll.h>
 #include <sys/event.h>
 
 #include <sys/socket.h>
@@ -138,7 +137,6 @@ static d_close_t    bpfclose;
 static d_read_t                bpfread;
 static d_write_t       bpfwrite;
 static d_ioctl_t       bpfioctl;
-static d_poll_t                bpfpoll;
 static d_kqfilter_t    bpfkqfilter;
 
 #define CDEV_MAJOR 23
@@ -149,7 +147,6 @@ static struct dev_ops bpf_ops = {
        .d_read =       bpfread,
        .d_write =      bpfwrite,
        .d_ioctl =      bpfioctl,
-       .d_poll =       bpfpoll,
        .d_kqfilter =   bpfkqfilter
 };
 
@@ -1071,51 +1068,6 @@ bpf_setif(struct bpf_d *d, struct ifreq *ifr)
        return(ENXIO);
 }
 
-/*
- * Support for select() and poll() system calls
- *
- * Return true iff the specific operation will not block indefinitely.
- * Otherwise, return false but make a note that a selwakeup() must be done.
- */
-static int
-bpfpoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       struct bpf_d *d;
-       int revents;
-
-       d = dev->si_drv1;
-       if (d->bd_bif == NULL)
-               return(ENXIO);
-
-       revents = ap->a_events & (POLLOUT | POLLWRNORM);
-       crit_enter();
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               /*
-                * An imitation of the FIONREAD ioctl code.
-                * XXX not quite.  An exact imitation:
-                *      if (d->b_slen != 0 ||
-                *          (d->bd_hbuf != NULL && d->bd_hlen != 0)
-                */
-               if (d->bd_hlen != 0 ||
-                   ((d->bd_immediate || d->bd_state == BPF_TIMED_OUT) &&
-                   d->bd_slen != 0)) {
-                       revents |= ap->a_events & (POLLIN | POLLRDNORM);
-               } else {
-                       selrecord(curthread, &d->bd_sel);
-                       /* Start the read timeout if necessary. */
-                       if (d->bd_rtout > 0 && d->bd_state == BPF_IDLE) {
-                               callout_reset(&d->bd_callout, d->bd_rtout,
-                                   bpf_timed_out, d);
-                               d->bd_state = BPF_WAITING;
-                       }
-               }
-       }
-       crit_exit();
-       ap->a_events = revents;
-       return(0);
-}
-
 static struct filterops bpf_read_filtops =
        { 1, NULL, bpf_filter_detach, bpf_filter_read };
 
index 6a0a835..5dff7cc 100644 (file)
@@ -66,9 +66,6 @@ static        d_open_t        i4bctlopen;
 static d_close_t       i4bctlclose;
 static d_ioctl_t       i4bctlioctl;
 
-static d_poll_t                i4bctlpoll;
-#define POLLFIELD      i4bctlpoll
-
 #define CDEV_MAJOR 55
 
 static struct dev_ops i4bctl_ops = {
@@ -76,7 +73,6 @@ static struct dev_ops i4bctl_ops = {
        .d_open =      i4bctlopen,
        .d_close =     i4bctlclose,
        .d_ioctl =     i4bctlioctl,
-       .d_poll =      POLLFIELD,
 };
 
 static void i4bctlattach(void *);
@@ -216,13 +212,4 @@ i4bctlioctl(struct dev_ioctl_args *ap)
 #endif /* DO_I4B_DEBUG */
 }
 
-/*---------------------------------------------------------------------------*
- *     i4bctlpoll - device driver poll routine
- *---------------------------------------------------------------------------*/
-static int
-i4bctlpoll (struct dev_poll_args *ap)
-{
-       return (ENODEV);
-}
-
 #endif /* NI4BCTL > 0 */
index 651eb5b..bb6db28 100644 (file)
@@ -60,7 +60,6 @@
 #include "../include/i4b_l3l4.h"
 #include "../layer4/i4b_l4.h"
 
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/filio.h>
 
@@ -125,9 +124,6 @@ PDEVSTATIC void i4brbchkfilt_detach(struct knote *);
 PDEVSTATIC int i4brbchkfilt_read(struct knote *, long);
 PDEVSTATIC int i4brbchkfilt_write(struct knote *, long);
 
-PDEVSTATIC d_poll_t i4brbchpoll;
-#define POLLFIELD      i4brbchpoll
-
 #define CDEV_MAJOR 57
 
 static struct dev_ops i4brbch_ops = {
@@ -137,7 +133,6 @@ static struct dev_ops i4brbch_ops = {
        .d_read =       i4brbchread,
        .d_write =      i4brbchwrite,
        .d_ioctl =      i4brbchioctl,
-       .d_poll =       POLLFIELD,
        .d_kqfilter =   i4brbchkqfilter
 };
 
@@ -536,59 +531,6 @@ i4brbchioctl(struct dev_ioctl_args *ap)
 /*---------------------------------------------------------------------------*
  *     device driver poll
  *---------------------------------------------------------------------------*/
-PDEVSTATIC int
-i4brbchpoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       int revents = 0;        /* Events we found */
-       int unit = minor(dev);
-       struct rbch_softc *sc = &rbch_softc[unit];
-       
-       /* We can't check for anything but IN or OUT */
-       crit_enter();
-
-       if(!(sc->sc_devstate & ST_ISOPEN))
-       {
-               crit_exit();
-               return(POLLNVAL);
-       }
-
-       /*
-        * Writes are OK if we are connected and the
-         * transmit queue can take them
-        */
-        
-       if((ap->a_events & (POLLOUT|POLLWRNORM)) &&
-          (sc->sc_devstate & ST_CONNECTED) &&
-          !IF_QFULL(isdn_linktab[unit]->tx_queue))
-       {
-               revents |= (ap->a_events & (POLLOUT|POLLWRNORM));
-       }
-       
-       /* ... while reads are OK if we have any data */
-
-       if((ap->a_events & (POLLIN|POLLRDNORM)) &&
-          (sc->sc_devstate & ST_CONNECTED))
-       {
-               struct ifqueue *iqp;
-
-               if(sc->sc_bprot == BPROT_RHDLC)
-                       iqp = &sc->sc_hdlcq;
-               else
-                       iqp = isdn_linktab[unit]->rx_queue;     
-
-               if(!IF_QEMPTY(iqp))
-                       revents |= (ap->a_events & (POLLIN|POLLRDNORM));
-       }
-               
-       if(revents == 0)
-               selrecord(curthread, &sc->selp);
-
-       crit_exit();
-       ap->a_events = revents;
-       return (0);
-}
-
 static struct filterops i4brbchkfiltops_read =
        { 1, NULL, i4brbchkfilt_detach, i4brbchkfilt_read };
 static struct filterops i4brbchkfiltops_write =
index 7d75f30..b9b5a67 100644 (file)
@@ -43,7 +43,6 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 
-#include <sys/poll.h>
 #include <sys/event.h>
 
 #include <sys/conf.h>
@@ -144,9 +143,6 @@ PDEVSTATIC d_write_t        i4btelwrite;
 PDEVSTATIC d_ioctl_t   i4btelioctl;
 PDEVSTATIC d_kqfilter_t        i4btelkqfilter;
 
-PDEVSTATIC d_poll_t i4btelpoll;
-#define POLLFIELD i4btelpoll
-
 PDEVSTATIC void i4btelfilt_detach(struct knote *);
 PDEVSTATIC int i4btelfilt_read(struct knote *, long);
 PDEVSTATIC int i4btelfilt_write(struct knote *, long);
@@ -160,7 +156,6 @@ static struct dev_ops i4btel_ops = {
        .d_read =       i4btelread,
        .d_write =      i4btelwrite,
        .d_ioctl =      i4btelioctl,
-       .d_poll =       POLLFIELD,
        .d_kqfilter =   i4btelkqfilter
 };
 
@@ -690,85 +685,6 @@ tel_tone(tel_sc_t *sc)
 /*---------------------------------------------------------------------------*
  *     device driver poll
  *---------------------------------------------------------------------------*/
-PDEVSTATIC int
-i4btelpoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       int revents = 0;        /* Events we found */
-       int unit = UNIT(dev);
-       int func = FUNC(dev);   
-
-       tel_sc_t *sc = &tel_sc[unit][func];
-       
-       crit_enter();
-
-       if(!(sc->devstate & ST_ISOPEN))
-       {
-               NDBGL4(L4_TELDBG, "i4btel%d, !ST_ISOPEN", unit);
-               crit_exit();
-               ap->a_events = 0;
-               return(0);
-       }
-
-       if(func == FUNCTEL)
-       {
-               /*
-                * Writes are OK if we are connected and the
-                * transmit queue can take them
-                */
-                
-               if((ap->a_events & (POLLOUT|POLLWRNORM))        &&
-                       (sc->devstate & ST_CONNECTED)   &&
-                       (sc->isdn_linktab != NULL)      &&
-                       (!IF_QFULL(sc->isdn_linktab->tx_queue)))
-               {
-                       NDBGL4(L4_TELDBG, "i4btel%d, POLLOUT", unit);
-                       revents |= (ap->a_events & (POLLOUT|POLLWRNORM));
-               }
-               
-               /* ... while reads are OK if we have any data */
-       
-               if((ap->a_events & (POLLIN|POLLRDNORM)) &&
-                       (sc->devstate & ST_CONNECTED)   &&
-                       (sc->isdn_linktab != NULL)      &&
-                       (!IF_QEMPTY(sc->isdn_linktab->rx_queue)))
-               {
-                       NDBGL4(L4_TELDBG, "i4btel%d, POLLIN", unit);
-                       revents |= (ap->a_events & (POLLIN|POLLRDNORM));
-               }
-                       
-               if(revents == 0)
-               {
-                       NDBGL4(L4_TELDBG, "i4btel%d, selrecord", unit);
-                       selrecord(curthread, &sc->selp);
-               }
-       }
-       else if(func == FUNCDIAL)
-       {
-               if(ap->a_events & (POLLOUT|POLLWRNORM))
-               {
-                       NDBGL4(L4_TELDBG, "i4bteld%d,  POLLOUT", unit);
-                       revents |= (ap->a_events & (POLLOUT|POLLWRNORM));
-               }
-
-               if(ap->a_events & (POLLIN|POLLRDNORM))
-               {
-                       NDBGL4(L4_TELDBG, "i4bteld%d,  POLLIN, result = %d", unit, sc->result);
-                       if(sc->result != 0)
-                               revents |= (ap->a_events & (POLLIN|POLLRDNORM));
-               }
-                       
-               if(revents == 0)
-               {
-                       NDBGL4(L4_TELDBG, "i4bteld%d,  selrecord", unit);
-                       selrecord(curthread, &sc->selp);
-               }
-       }
-       crit_exit();
-       ap->a_events = revents;
-       return (0);
-}
-
 PDEVSTATIC struct filterops i4btelfiltops_read =
        { 1, NULL, i4btelfilt_detach, i4btelfilt_read };
 PDEVSTATIC struct filterops i4btelfiltops_write =
index d200aac..dd14c2f 100644 (file)
@@ -73,9 +73,6 @@ static d_close_t i4btrcclose;
 static d_read_t i4btrcread;
 static d_ioctl_t i4btrcioctl;
 
-static d_poll_t i4btrcpoll;
-#define POLLFIELD i4btrcpoll
-
 #define CDEV_MAJOR 59
 
 static struct dev_ops i4btrc_ops = {
@@ -84,7 +81,6 @@ static struct dev_ops i4btrc_ops = {
         .d_close =     i4btrcclose,
         .d_read =      i4btrcread,
         .d_ioctl =     i4btrcioctl,
-        .d_poll =      POLLFIELD,
 };
 
 /*---------------------------------------------------------------------------*
@@ -338,15 +334,6 @@ i4btrcread(struct dev_read_args *ap)
 }
 
 /*---------------------------------------------------------------------------*
- *     poll device
- *---------------------------------------------------------------------------*/
-PDEVSTATIC int
-i4btrcpoll(struct dev_poll_args *ap)
-{
-       return(ENODEV);
-}
-
-/*---------------------------------------------------------------------------*
  *     device driver ioctl routine
  *---------------------------------------------------------------------------*/
 PDEVSTATIC int
index 9a28f2b..2577f44 100644 (file)
@@ -72,7 +72,6 @@
 
 #include "i4b_l4.h"
 
-#include <sys/poll.h>
 #include <sys/event.h>
 
 struct selinfo select_rd_info;
@@ -93,9 +92,6 @@ PDEVSTATIC void i4bkqfilt_detach(struct knote *);
 PDEVSTATIC int i4bkqfilt_read(struct knote *, long);
 PDEVSTATIC int i4bkqfilt_write(struct knote *, long);
 
-PDEVSTATIC     d_poll_t        i4bpoll;
-#define POLLFIELD              i4bpoll
-
 #define CDEV_MAJOR 60
 
 static struct dev_ops i4b_ops = {
@@ -104,7 +100,6 @@ static struct dev_ops i4b_ops = {
        .d_close =      i4bclose,
        .d_read =       i4bread,
        .d_ioctl =      i4bioctl,
-       .d_poll =       POLLFIELD,
        .d_kqfilter =   i4bkqfilter
 };
 
@@ -733,36 +728,8 @@ diag_done:
 }
 
 /*---------------------------------------------------------------------------*
- *     i4bpoll - device driver poll routine
+ *     i4bkqfilter - device driver poll routine
  *---------------------------------------------------------------------------*/
-PDEVSTATIC int
-i4bpoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       int revents;
-
-       if (minor(dev))
-               return(ENODEV);
-
-       revents = 0;
-
-       if (ap->a_events & (POLLIN|POLLRDNORM)) {
-               crit_enter();
-               if (!IF_QEMPTY(&i4b_rdqueue)) {
-                       revents |= POLLIN | POLLRDNORM;
-               } else {
-                       selrecord(curthread, &select_rd_info);
-               }
-               crit_exit();
-               return(0);
-       }
-       if (ap->a_events & (POLLOUT|POLLWRNORM)) {
-               revents |= ap->a_events & (POLLOUT | POLLWRNORM);
-       }
-       ap->a_events = revents;
-       return(0);
-}
-
 static struct filterops i4bkqfiltops_read =
        { 1, NULL, i4bkqfilt_detach, i4bkqfilt_read };
 static struct filterops i4bkqfiltops_write =
index 9b74641..d223625 100644 (file)
@@ -46,7 +46,6 @@
 #include <sys/kernel.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
-#include <sys/poll.h>
 #include <sys/proc.h>
 #include <sys/priv.h>
 #include <sys/signalvar.h>
@@ -117,7 +116,6 @@ static d_close_t    tapclose;
 static d_read_t                tapread;
 static d_write_t       tapwrite;
 static d_ioctl_t       tapioctl;
-static d_poll_t                tappoll;
 static d_kqfilter_t    tapkqfilter;
 
 static struct dev_ops  tap_ops = {
@@ -127,7 +125,6 @@ static struct dev_ops       tap_ops = {
        .d_read =       tapread,
        .d_write =      tapwrite,
        .d_ioctl =      tapioctl,
-       .d_poll =       tappoll,
        .d_kqfilter =   tapkqfilter
 };
 
@@ -942,50 +939,6 @@ tapwrite(struct dev_write_args *ap)
 }
 
 /*
- * tappoll
- *
- * 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
- *
- * Called from the fileops interface with nothing held.
- *
- * MPSAFE
- */
-static int
-tappoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       struct tap_softc        *tp = dev->si_drv1;
-       struct ifnet            *ifp = &tp->tap_if;
-       int                      revents = 0;
-
-       TAPDEBUG(ifp, "polling, minor = %#x\n", minor(tp->tap_dev));
-
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (!IF_QEMPTY(&tp->tap_devq)) {
-                       TAPDEBUG(ifp,
-                                "has data in queue. minor = %#x\n",
-                                minor(tp->tap_dev));
-
-                       revents |= (ap->a_events & (POLLIN | POLLRDNORM));
-               } else {
-                       TAPDEBUG(ifp, "waiting for data, minor = %#x\n",
-                                minor(tp->tap_dev));
-
-                       get_mplock();
-                       selrecord(curthread, &tp->tap_rsel);
-                       rel_mplock();
-               }
-       }
-
-       if (ap->a_events & (POLLOUT | POLLWRNORM))
-               revents |= (ap->a_events & (POLLOUT | POLLWRNORM));
-       ap->a_events = revents;
-       return (0);
-}
-
-/*
  * tapkqfilter - called from the fileops interface with nothing held
  *
  * MPSAFE
index 9d45ab0..8f6ab09 100644 (file)
@@ -35,7 +35,6 @@
 #include <sys/sockio.h>
 #include <sys/thread2.h>
 #include <sys/ttycom.h>
-#include <sys/poll.h>
 #include <sys/signalvar.h>
 #include <sys/filedesc.h>
 #include <sys/kernel.h>
@@ -87,7 +86,6 @@ static        d_close_t       tunclose;
 static d_read_t        tunread;
 static d_write_t       tunwrite;
 static d_ioctl_t       tunioctl;
-static d_poll_t        tunpoll;
 static d_kqfilter_t    tunkqfilter;
 
 static d_clone_t tunclone;
@@ -107,7 +105,6 @@ static struct dev_ops tun_ops = {
        .d_read =       tunread,
        .d_write =      tunwrite,
        .d_ioctl =      tunioctl,
-       .d_poll =       tunpoll,
        .d_kqfilter =   tunkqfilter
 };
 
@@ -702,40 +699,6 @@ tunwrite(struct dev_write_args *ap)
        return (0);
 }
 
-/*
- * 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.
- */
-static int
-tunpoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       struct tun_softc *tp = dev->si_drv1;
-       struct ifnet    *ifp = &tp->tun_if;
-       int             revents = 0;
-
-       TUNDEBUG(ifp, "tunpoll\n");
-
-       ifnet_serialize_all(ifp);
-
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (!ifq_is_empty(&ifp->if_snd)) {
-                       TUNDEBUG(ifp, "tunpoll q=%d\n", ifp->if_snd.ifq_len);
-                       revents |= ap->a_events & (POLLIN | POLLRDNORM);
-               } else {
-                       TUNDEBUG(ifp, "tunpoll waiting\n");
-                       selrecord(curthread, &tp->tun_rsel);
-               }
-       }
-       if (ap->a_events & (POLLOUT | POLLWRNORM))
-               revents |= ap->a_events & (POLLOUT | POLLWRNORM);
-
-       ifnet_deserialize_all(ifp);
-       ap->a_events = revents;
-       return(0);
-}
-
 static struct filterops tun_read_filtops =
        { 1, NULL, tun_filter_detach, tun_filter_read };
 static struct filterops tun_write_filtops =
index 9bb7d4f..1f317f0 100644 (file)
@@ -40,7 +40,6 @@
 #include <sys/fcntl.h>
 #include <sys/malloc.h>
 #include <sys/file.h>          /* Must come after sys/malloc.h */
-#include <sys/poll.h>
 #include <sys/proc.h>
 #include <sys/select.h>
 #include <sys/socket.h>
@@ -68,7 +67,6 @@ static d_close_t nsmb_dev_close;
 static d_read_t         nsmb_dev_read;
 static d_write_t nsmb_dev_write;
 static d_ioctl_t nsmb_dev_ioctl;
-static d_poll_t         nsmb_dev_poll;
 static d_clone_t nsmbclone;
 DEVFS_DECLARE_CLONE_BITMAP(nsmb);
 
@@ -96,7 +94,6 @@ static struct dev_ops nsmb_ops = {
        .d_read =       nsmb_dev_read,
        .d_write =      nsmb_dev_write,
        .d_ioctl =      nsmb_dev_ioctl,
-       .d_poll =       nsmb_dev_poll,
 };
 
 
@@ -331,12 +328,6 @@ nsmb_dev_write(struct dev_write_args *ap)
 }
 
 static int
-nsmb_dev_poll(struct dev_poll_args *ap)
-{
-       return ENODEV;
-}
-
-static int
 nsmbclone(struct dev_clone_args *ap)
 {
        int unit;
index 4387bb6..89d69fc 100644 (file)
@@ -67,7 +67,6 @@ static d_open_t apmopen;
 static d_close_t apmclose;
 static d_write_t apmwrite;
 static d_ioctl_t apmioctl;
-static d_poll_t apmpoll;
 static d_kqfilter_t apmkqfilter;
 
 #define CDEV_MAJOR 39
@@ -77,7 +76,6 @@ static struct dev_ops apm_ops = {
         .d_close = apmclose,
        .d_write = apmwrite,
         .d_ioctl = apmioctl,
-       .d_poll = apmpoll,
        .d_kqfilter = apmkqfilter
 };
 
@@ -297,13 +295,6 @@ apmwrite(struct dev_write_args *ap)
        return (ap->a_uio->uio_resid);
 }
 
-static int
-apmpoll(struct dev_poll_args *ap)
-{
-       ap->a_events = 0;
-       return (0);
-}
-
 static void apmfilter_detach(struct knote *);
 static int apmfilter(struct knote *, long);
 
index 0b30682..e4c0980 100644 (file)
@@ -29,7 +29,6 @@
 #include <sys/reboot.h>
 #include <sys/bus.h>
 #include <sys/selinfo.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/fcntl.h>
 #include <sys/uio.h>
@@ -83,11 +82,11 @@ static d_open_t apmopen;
 static d_close_t apmclose;
 static d_write_t apmwrite;
 static d_ioctl_t apmioctl;
-static d_poll_t apmpoll;
 static d_kqfilter_t apmkqfilter;
 
 static void apmfilter_detach(struct knote *);
-static int apmfilter(struct knote *, long);
+static int apmfilter_read(struct knote *, long);
+static int apmfilter_write(struct knote *, long);
 
 #define CDEV_MAJOR 39
 static struct dev_ops apm_ops = {
@@ -96,7 +95,6 @@ static struct dev_ops apm_ops = {
        .d_close =      apmclose,
        .d_write =      apmwrite,
        .d_ioctl =      apmioctl,
-       .d_poll =       apmpoll,
        .d_kqfilter =   apmkqfilter
 };
 
@@ -1342,25 +1340,10 @@ apmwrite(struct dev_write_args *ap)
        return uio->uio_resid;
 }
 
-static int
-apmpoll(struct dev_poll_args *ap)
-{
-       struct apm_softc *sc = &apm_softc;
-       int revents = 0;
-
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (sc->event_count) {
-                       revents |= ap->a_events & (POLLIN | POLLRDNORM);
-               } else {
-                       selrecord(curthread, &sc->sc_rsel);
-               }
-       }
-       ap->a_events = revents;
-       return (0);
-}
-
-static struct filterops apmfiltops =
-       { 1, NULL, apmfilter_detach, apmfilter };
+static struct filterops apmfiltops_read =
+       { 1, NULL, apmfilter_detach, apmfilter_read };
+static struct filterops apmfiltops_write =
+       { 1, NULL, apmfilter_detach, apmfilter_write };
 
 static int
 apmkqfilter(struct dev_kqfilter_args *ap)
@@ -1373,7 +1356,11 @@ apmkqfilter(struct dev_kqfilter_args *ap)
 
        switch (kn->kn_filter) {
        case EVFILT_READ:
-               kn->kn_fop = &apmfiltops;
+               kn->kn_fop = &apmfiltops_read;
+               kn->kn_hook = (caddr_t)sc;
+               break;
+       case EVFILT_WRITE:
+               kn->kn_fop = &apmfiltops_write;
                kn->kn_hook = (caddr_t)sc;
                break;
        default:
@@ -1402,7 +1389,7 @@ apmfilter_detach(struct knote *kn)
 }
 
 static int
-apmfilter(struct knote *kn, long hint)
+apmfilter_read(struct knote *kn, long hint)
 {
        struct apm_softc *sc = (struct apm_softc *)kn->kn_hook;
        int ready = 0;
@@ -1413,6 +1400,13 @@ apmfilter(struct knote *kn, long hint)
        return (ready);
 }
 
+static int
+apmfilter_write(struct knote *kn, long hint)
+{
+       /* write()'s are always OK */
+       return (1);
+}
+
 /*
  * Because apm is a static device that always exists under any attached
  * isa device, and not scanned by the isa device, we need an identify
index 9ad482a..9c329d2 100644 (file)
@@ -227,7 +227,6 @@ static struct cdevsw dgb_cdevsw = {
        /* read */      ttyread,
        /* write */     ttywrite,
        /* ioctl */     dgbioctl,
-       /* poll */      ttypoll,
        /* mmap */      nommap,
        /* strategy */  nostrategy,
        /* dump */      nodump,
index e2ce868..47421a7 100644 (file)
@@ -46,7 +46,6 @@
 #include <sys/buf.h>
 #include <sys/malloc.h>
 #include <sys/kernel.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/selinfo.h>
 #include <sys/uio.h>
@@ -186,7 +185,6 @@ static d_open_t             ascopen;
 static d_close_t       ascclose;
 static d_read_t                ascread;
 static d_ioctl_t       ascioctl;
-static d_poll_t                ascpoll;
 static d_kqfilter_t    asckqfilter;
 
 static void ascfilter_detach(struct knote *kn);
@@ -200,7 +198,6 @@ static struct dev_ops asc_ops = {
        .d_close =      ascclose,
        .d_read =       ascread,
        .d_ioctl =      ascioctl,
-       .d_poll =       ascpoll,
        .d_kqfilter =   asckqfilter
 };
 
@@ -852,31 +849,6 @@ ascioctl(struct dev_ioctl_args *ap)
   return SUCCESS;
 }
 
-STATIC int
-ascpoll(struct dev_poll_args *ap)
-{
-    cdev_t dev = ap->a_head.a_dev;
-    int unit = UNIT(minor(dev));
-    struct asc_unit *scu = unittab + unit;
-    int revents = 0;
-
-    crit_enter();
-
-    if (ap->a_events & (POLLIN | POLLRDNORM)) {
-       if (scu->sbuf.count >0)
-           revents |= ap->a_events & (POLLIN | POLLRDNORM);
-       else {
-           if (!(scu->flags & DMA_ACTIVE))
-               dma_restart(scu);
-
-           selrecord(curthread, &scu->selp);
-       }
-    }
-    crit_exit();
-    ap->a_events = revents;
-    return (0);
-}
-
 static struct filterops ascfiltops =
     { 1, NULL, ascfilter_detach, ascfilter };
 
index da44709..63d500c 100644 (file)
@@ -63,7 +63,6 @@ static d_open_t apmopen;
 static d_close_t apmclose;
 static d_write_t apmwrite;
 static d_ioctl_t apmioctl;
-static d_poll_t apmpoll;
 static d_kqfilter_t apmkqfilter;
 
 #define CDEV_MAJOR 39
@@ -73,7 +72,6 @@ static struct dev_ops apm_ops = {
         .d_close = apmclose,
        .d_write = apmwrite,
         .d_ioctl = apmioctl,
-       .d_poll = apmpoll,
        .d_kqfilter = apmkqfilter
 };
 
@@ -293,13 +291,6 @@ apmwrite(struct dev_write_args *ap)
        return (ap->a_uio->uio_resid);
 }
 
-static int
-apmpoll(struct dev_poll_args *ap)
-{
-       ap->a_events = 0;
-       return (0);
-}
-
 static void apmfilter_detach(struct knote *);
 static int apmfilter(struct knote *, long);
 
index 902f355..a77e830 100644 (file)
@@ -29,7 +29,6 @@
 #include <sys/reboot.h>
 #include <sys/bus.h>
 #include <sys/selinfo.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/fcntl.h>
 #include <sys/uio.h>
@@ -83,11 +82,11 @@ static d_open_t apmopen;
 static d_close_t apmclose;
 static d_write_t apmwrite;
 static d_ioctl_t apmioctl;
-static d_poll_t apmpoll;
 static d_kqfilter_t apmkqfilter;
 
 static void apmfilter_detach(struct knote *);
-static int apmfilter(struct knote *, long);
+static int apmfilter_read(struct knote *, long);
+static int apmfilter_write(struct knote *, long);
 
 #define CDEV_MAJOR 39
 static struct dev_ops apm_ops = {
@@ -96,7 +95,6 @@ static struct dev_ops apm_ops = {
        .d_close =      apmclose,
        .d_write =      apmwrite,
        .d_ioctl =      apmioctl,
-       .d_poll =       apmpoll,
        .d_kqfilter =   apmkqfilter
 };
 
@@ -1342,25 +1340,10 @@ apmwrite(struct dev_write_args *ap)
        return uio->uio_resid;
 }
 
-static int
-apmpoll(struct dev_poll_args *ap)
-{
-       struct apm_softc *sc = &apm_softc;
-       int revents = 0;
-
-       if (ap->a_events & (POLLIN | POLLRDNORM)) {
-               if (sc->event_count) {
-                       revents |= ap->a_events & (POLLIN | POLLRDNORM);
-               } else {
-                       selrecord(curthread, &sc->sc_rsel);
-               }
-       }
-       ap->a_events = revents;
-       return (0);
-}
-
-static struct filterops apmfiltops =
-       { 1, NULL, apmfilter_detach, apmfilter };
+static struct filterops apmfiltops_read =
+       { 1, NULL, apmfilter_detach, apmfilter_read };
+static struct filterops apmfiltops_write =
+       { 1, NULL, apmfilter_detach, apmfilter_write };
 
 static int
 apmkqfilter(struct dev_kqfilter_args *ap)
@@ -1373,7 +1356,11 @@ apmkqfilter(struct dev_kqfilter_args *ap)
 
        switch (kn->kn_filter) {
        case EVFILT_READ:
-               kn->kn_fop = &apmfiltops;
+               kn->kn_fop = &apmfiltops_read;
+               kn->kn_hook = (caddr_t)sc;
+               break;
+       case EVFILT_WRITE:
+               kn->kn_fop = &apmfiltops_write;
                kn->kn_hook = (caddr_t)sc;
                break;
        default:
@@ -1402,7 +1389,7 @@ apmfilter_detach(struct knote *kn)
 }
 
 static int
-apmfilter(struct knote *kn, long hint)
+apmfilter_read(struct knote *kn, long hint)
 {
        struct apm_softc *sc = (struct apm_softc *)kn->kn_hook;
        int ready = 0;
@@ -1413,6 +1400,13 @@ apmfilter(struct knote *kn, long hint)
        return (ready);
 }
 
+static int
+apmfilter_write(struct knote *kn, long hint)
+{
+       /* write()'s are always OK */
+       return (1);
+}
+
 /*
  * Because apm is a static device that always exists under any attached
  * isa device, and not scanned by the isa device, we need an identify
index 2c49ec2..cd2789f 100644 (file)
@@ -47,7 +47,6 @@
 #include <sys/buf.h>
 #include <sys/malloc.h>
 #include <sys/kernel.h>
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/selinfo.h>
 #include <sys/uio.h>
@@ -185,7 +184,6 @@ static d_open_t             ascopen;
 static d_close_t       ascclose;
 static d_read_t                ascread;
 static d_ioctl_t       ascioctl;
-static d_poll_t                ascpoll;
 static d_kqfilter_t    asckqfilter;
 
 static void ascfilter_detach(struct knote *kn);
@@ -199,7 +197,6 @@ static struct dev_ops asc_ops = {
        .d_close =      ascclose,
        .d_read =       ascread,
        .d_ioctl =      ascioctl,
-       .d_poll =       ascpoll,
        .d_kqfilter =   asckqfilter
 };
 
@@ -851,31 +848,6 @@ ascioctl(struct dev_ioctl_args *ap)
   return SUCCESS;
 }
 
-STATIC int
-ascpoll(struct dev_poll_args *ap)
-{
-    cdev_t dev = ap->a_head.a_dev;
-    int unit = UNIT(minor(dev));
-    struct asc_unit *scu = unittab + unit;
-    int revents = 0;
-
-    crit_enter();
-
-    if (ap->a_events & (POLLIN | POLLRDNORM)) {
-       if (scu->sbuf.count >0)
-           revents |= ap->a_events & (POLLIN | POLLRDNORM);
-       else {
-           if (!(scu->flags & DMA_ACTIVE))
-               dma_restart(scu);
-
-           selrecord(curthread, &scu->selp);
-       }
-    }
-    crit_exit();
-    ap->a_events = revents;
-    return (0);
-}
-
 static struct filterops ascfiltops =
     { 1, NULL, ascfilter_detach, ascfilter };
 
index c942d0c..54de5a9 100644 (file)
@@ -88,7 +88,6 @@ static struct dev_ops vcons_ops = {
        .d_read =       ttyread,
        .d_write =      ttywrite,
        .d_ioctl =      vcons_ioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter,
 };
 
index f07834a..353bd51 100644 (file)
@@ -88,7 +88,6 @@ static struct dev_ops vcons_ops = {
        .d_read =       ttyread,
        .d_write =      ttywrite,
        .d_ioctl =      vcons_ioctl,
-       .d_poll =       ttypoll,
        .d_kqfilter =   ttykqfilter
 };
 
index 485d527..52d2d10 100644 (file)
@@ -112,14 +112,6 @@ struct dev_ioctl_args {
 };
 
 /*
- * int d_poll(cdev_t dev, int events)
- */
-struct dev_poll_args {
-       struct dev_generic_args a_head;
-       int             a_events;
-};
-
-/*
  * int d_mmap(cdev_t dev, vm_offset_t offset, int nprot)
  */
 struct dev_mmap_args {
@@ -198,7 +190,6 @@ typedef int d_close_t (struct dev_close_args *ap);
 typedef int d_read_t (struct dev_read_args *ap);
 typedef int d_write_t (struct dev_write_args *ap);
 typedef int d_ioctl_t (struct dev_ioctl_args *ap);
-typedef int d_poll_t (struct dev_poll_args *ap);
 typedef int d_mmap_t (struct dev_mmap_args *ap);
 typedef int d_strategy_t (struct dev_strategy_args *ap);
 typedef int d_dump_t (struct dev_dump_args *ap);
@@ -229,7 +220,6 @@ struct dev_ops {
        d_read_t        *d_read;
        d_write_t       *d_write;
        d_ioctl_t       *d_ioctl;
-       d_poll_t        *d_poll;
        d_mmap_t        *d_mmap;
        d_strategy_t    *d_strategy;
        d_dump_t        *d_dump;
@@ -274,7 +264,6 @@ union dev_args_union {
        struct dev_read_args    du_read;
        struct dev_write_args   du_write;
        struct dev_ioctl_args   du_ioctl;
-       struct dev_poll_args    du_poll;
        struct dev_mmap_args    du_mmap;
        struct dev_strategy_args du_strategy;
        struct dev_dump_args    du_dump;
@@ -320,7 +309,6 @@ int dev_ddump(cdev_t dev, void *virtual, vm_offset_t physical, off_t offset,
 int64_t dev_dpsize(cdev_t dev);
 int dev_dread(cdev_t dev, struct uio *uio, int ioflag);
 int dev_dwrite(cdev_t dev, struct uio *uio, int ioflag);
-int dev_dpoll(cdev_t dev, int events);
 int dev_dkqfilter(cdev_t dev, struct knote *kn);
 int dev_dmmap(cdev_t dev, vm_offset_t offset, int nprot);
 int dev_dclone(cdev_t dev);
@@ -339,7 +327,6 @@ d_close_t   noclose;
 d_read_t       noread;
 d_write_t      nowrite;
 d_ioctl_t      noioctl;
-d_poll_t       nopoll;
 d_mmap_t       nommap;
 d_strategy_t   nostrategy;
 d_dump_t       nodump;
@@ -359,7 +346,6 @@ extern struct syslink_desc dev_write_desc;
 extern struct syslink_desc dev_ioctl_desc;
 extern struct syslink_desc dev_dump_desc;
 extern struct syslink_desc dev_psize_desc;
-extern struct syslink_desc dev_poll_desc;
 extern struct syslink_desc dev_mmap_desc;
 extern struct syslink_desc dev_strategu_desc;
 extern struct syslink_desc dev_kqfilter_desc;
index 52ef3b0..99c5dfc 100644 (file)
@@ -281,7 +281,6 @@ int  ttylclose (struct tty *tp, int flag);
 struct tty *ttymalloc (struct tty *tp);
 int     ttymodem (struct tty *tp, int flag);
 int     ttyopen (cdev_t device, struct tty *tp);
-int     ttypoll (struct dev_poll_args *);
 int     ttykqfilter (struct dev_kqfilter_args *);
 int     ttyread (struct dev_read_args *);
 void    ttyregister (struct tty *tp);
index 44db541..9d6272e 100644 (file)
@@ -96,7 +96,6 @@ static int devfs_spec_fsync(struct vop_fsync_args *);
 static int devfs_spec_read(struct vop_read_args *);
 static int devfs_spec_write(struct vop_write_args *);
 static int devfs_spec_ioctl(struct vop_ioctl_args *);
-static int devfs_spec_poll(struct vop_poll_args *);
 static int devfs_spec_kqfilter(struct vop_kqfilter_args *);
 static int devfs_spec_strategy(struct vop_strategy_args *);
 static void devfs_spec_strategy_done(struct bio *);
@@ -112,7 +111,6 @@ static int devfs_specf_read(struct file *, struct uio *, struct ucred *, int);
 static int devfs_specf_write(struct file *, struct uio *, struct ucred *, int);
 static int devfs_specf_stat(struct file *, struct stat *, struct ucred *);
 static int devfs_specf_kqfilter(struct file *, struct knote *);
-static int devfs_specf_poll(struct file *, int, struct ucred *);
 static int devfs_specf_ioctl(struct file *, u_long, caddr_t,
                                struct ucred *, struct sysmsg *);
 static __inline int sequential_heuristic(struct uio *, struct file *);
@@ -171,7 +169,6 @@ struct vop_ops devfs_vnode_dev_vops = {
        .vop_open =                     devfs_spec_open,
        .vop_pathconf =         vop_stdpathconf,
        .vop_print =            devfs_print,
-       .vop_poll =                     devfs_spec_poll,
        .vop_kqfilter =         devfs_spec_kqfilter,
        .vop_read =                     devfs_spec_read,
        .vop_readdir =          DEVFS_BADOP,
@@ -189,7 +186,6 @@ struct fileops devfs_dev_fileops = {
        .fo_read = devfs_specf_read,
        .fo_write = devfs_specf_write,
        .fo_ioctl = devfs_specf_ioctl,
-       .fo_poll = devfs_specf_poll,
        .fo_kqfilter = devfs_specf_kqfilter,
        .fo_stat = devfs_specf_stat,
        .fo_close = devfs_specf_close,
@@ -1394,43 +1390,6 @@ done:
        return (error);
 }
 
-
-static int
-devfs_specf_poll(struct file *fp, int events, struct ucred *cred)
-{
-       struct devfs_node *node;
-       struct vnode *vp;
-       int error;
-       cdev_t dev;
-
-       get_mplock();
-
-       vp = (struct vnode *)fp->f_data;
-       if (vp == NULL || vp->v_type == VBAD) {
-               error = EBADF;
-               goto done;
-       }
-       node = DEVFS_NODE(vp);
-
-       if ((dev = vp->v_rdev) == NULL) {
-               error = EBADF;
-               goto done;
-       }
-       reference_dev(dev);
-       error = dev_dpoll(dev, events);
-
-       release_dev(dev);
-
-#if 0
-       if (node)
-               nanotime(&node->atime);
-#endif
-done:
-       rel_mplock();
-       return (error);
-}
-
-
 /*
  * MPALMOSTSAFE - acquires mplock
  */
@@ -1652,29 +1611,6 @@ devfs_spec_ioctl(struct vop_ioctl_args *ap)
 }
 
 /*
- * spec_poll(struct vnode *a_vp, int a_events, struct ucred *a_cred)
- */
-/* ARGSUSED */
-static int
-devfs_spec_poll(struct vop_poll_args *ap)
-{
-       struct vnode *vp = ap->a_vp;
-       struct devfs_node *node;
-       cdev_t dev;
-
-       if ((dev = vp->v_rdev) == NULL)
-               return (EBADF);         /* device was revoked */
-       node = DEVFS_NODE(vp);
-
-#if 0
-       if (node)
-               nanotime(&node->atime);
-#endif
-
-       return (dev_dpoll(dev, ap->a_events));
-}
-
-/*
  * spec_kqfilter(struct vnode *a_vp, struct knote *a_kn)
  */
 /* ARGSUSED */