kernel - Add missing KNOTE's
authorSamuel J. Greear <sjg@thesjg.com>
Wed, 14 Jul 2010 19:24:30 +0000 (19:24 +0000)
committerSamuel J. Greear <sjg@thesjg.com>
Wed, 14 Jul 2010 19:38:02 +0000 (19:38 +0000)
* Place a KNOTE call anywhere there is currently a call to selwakeup.

34 files changed:
sys/bus/firewire/firewire.c
sys/bus/usb/usb.c
sys/dev/misc/cmx/cmx.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/tw/tw.c
sys/dev/raid/aac/aac.c
sys/dev/serial/stl/stallion.c
sys/dev/serial/stli/istallion.c
sys/dev/sound/pcm/buffer.c
sys/dev/usbmisc/ucom/ucom.c
sys/dev/usbmisc/ugen/ugen.c
sys/dev/usbmisc/uhid/uhid.c
sys/dev/video/bktr/bktr_core.c
sys/dev/video/cxm/cxm.c
sys/kern/kern_udev.c
sys/kern/subr_bus.c
sys/kern/subr_log.c
sys/kern/sys_mqueue.c
sys/net/bpf.c
sys/net/i4b/driver/i4b_rbch.c
sys/net/i4b/driver/i4b_tel.c
sys/net/i4b/layer4/i4b_i4bdrv.c
sys/net/tap/if_tap.c
sys/net/tun/if_tun.c
sys/platform/pc32/apm/apm.c
sys/platform/pc32/isa/asc.c
sys/platform/pc64/apm/apm.c
sys/platform/pc64/isa/asc.c

index 6dffc25..145caa7 100644 (file)
@@ -1956,6 +1956,7 @@ fw_rcv(struct fw_rcv_buf *rb)
                if (SEL_WAITING(&xferq->rsel))
 #endif
                        selwakeuppri(&xferq->rsel, FWPRI);
+               KNOTE(&xferq->rsel.si_note, 0);
                if (xferq->flag & FWXFERQ_WAKEUP) {
                        xferq->flag &= ~FWXFERQ_WAKEUP;
                        wakeup((caddr_t)xferq);
index 35f3b74..8c0b571 100644 (file)
@@ -871,6 +871,7 @@ usb_add_event(int type, struct usb_event *uep)
        usb_nevents++;
        wakeup(&usb_events);
        selwakeup(&usb_selevent);
+       KNOTE(&usb_selevent.si_note, 0);
        if (usb_async_proc != NULL) {
                ksignal(usb_async_proc, SIGIO);
        }
index 16e138a..54ccb3e 100644 (file)
@@ -282,6 +282,7 @@ cmx_detach(device_t dev)
                sc->polling = 0;
                CMX_UNLOCK(sc);
                selwakeup(&sc->sel);
+               KNOTE(&sc->sel.si_note, 0);
        } else {
                CMX_UNLOCK(sc);
        }
@@ -405,6 +406,7 @@ cmx_tick(void *xsc)
                if (cmx_test(bsr, BSR_BULK_IN_FULL, 1)) {
                        sc->polling = 0;
                        selwakeup(&sc->sel);
+                       KNOTE(&sc->sel.si_note, 0);
                } else {
                        callout_reset(&sc->ch, POLL_TICKS, cmx_tick, sc);
                }
@@ -463,6 +465,7 @@ cmx_close(struct dev_close_args *ap)
                sc->polling = 0;
                CMX_UNLOCK(sc);
                selwakeup(&sc->sel);
+               KNOTE(&sc->sel.si_note, 0);
                CMX_LOCK(sc);
        }
        sc->open = 0;
@@ -504,6 +507,7 @@ cmx_read(struct dev_read_args *ap)
                sc->polling = 0;
                CMX_UNLOCK(sc);
                selwakeup(&sc->sel);
+               KNOTE(&sc->sel.si_note, 0);
        } else {
                CMX_UNLOCK(sc);
        }
index 043e92f..a16d719 100644 (file)
@@ -222,6 +222,7 @@ hotplug_put_event(struct hotplug_event *he)
        wakeup(&hpsc);
        lockmgr(&hpsc.lock, LK_RELEASE);
        selwakeup(&hpsc.sel);
+       KNOTE(&hpsc.sel.si_note, 0);
        return (0);
 }
 
index 1d86f1f..eb1437a 100644 (file)
@@ -837,6 +837,7 @@ genkbd_event(keyboard_t *kbd, int event, void *arg)
                        wakeup((caddr_t)sc);
                }
                selwakeup(&sc->gkb_rsel);
+               KNOTE(&sc->gkb_rsel.si_note, 0);
                return 0;
        default:
                return EINVAL;
@@ -907,6 +908,7 @@ genkbd_event(keyboard_t *kbd, int event, void *arg)
                        wakeup((caddr_t)sc);
                }
                selwakeup(&sc->gkb_rsel);
+               KNOTE(&sc->gkb_rsel.si_note, 0);
        }
 
        return 0;
index 3d660dd..a14a7a8 100644 (file)
@@ -758,6 +758,7 @@ mseintr(void *arg)
                        wakeup((caddr_t)sc);
                }
                selwakeup(&sc->sc_selp);
+               KNOTE(&sc->sc_selp.si_note, 0);
        }
 }
 
index 7bd4375..f07a921 100644 (file)
@@ -443,10 +443,12 @@ wakeup_other(struct tty *tp, int flag)
        if (flag & FREAD) {
                selwakeup(&otherpart->nm_tty.t_rsel);
                wakeup(TSA_PTC_READ((&otherpart->nm_tty)));
+               KNOTE(&otherpart->nm_tty.t_rsel.si_note, 0);
        }
        if (flag & FWRITE) {
                selwakeup(&otherpart->nm_tty.t_wsel);
                wakeup(TSA_PTC_WRITE((&otherpart->nm_tty)));
+               KNOTE(&otherpart->nm_tty.t_wsel.si_note, 0);
        }
 }
 
index 3e69ec6..2e63d76 100644 (file)
@@ -2378,6 +2378,7 @@ psmintr(void *arg)
             wakeup((caddr_t) sc);
        }
         selwakeup(&sc->rsel);
+       KNOTE(&sc->rsel.si_note, 0);
     }
 }
 
index de5487a..003f4c5 100644 (file)
@@ -367,6 +367,7 @@ snp_in(struct snoop *snp, char *buf, int n)
        }
        selwakeup(&snp->snp_sel);
        snp->snp_sel.si_pid = 0;
+       KNOTE(&snp->snp_sel.si_note, 0);
 
        return (n);
 }
@@ -440,6 +441,7 @@ snp_detach(struct snoop *snp)
 detach_notty:
        selwakeup(&snp->snp_sel);
        snp->snp_sel.si_pid = 0;
+       KNOTE(&snp->snp_sel.si_note, 0);
        if ((snp->snp_flags & SNOOP_OPEN) == 0) 
                kfree(snp, M_SNP);
 
index 40d5516..9e1ae0b 100644 (file)
@@ -439,6 +439,7 @@ spictimeout(void *arg)
                        wakeup((caddr_t) sc);
                }
                selwakeup(&sc->sc_rsel);
+               KNOTE(&sc->sc_rsel.si_note, 0);
        }
        spic_call2(sc, 0x81, 0xff); /* Clear event */
 
index 12a1915..72d4468 100644 (file)
@@ -883,6 +883,7 @@ twputpkt(struct tw_sc *sc, u_char *p)
     wakeup((caddr_t)(&sc->sc_buf));
   }
   selwakeup(&sc->sc_selp);
+  KNOTE(&sc->sc_selp.si_note, 0);
   return(0);
 }
 
index bc4bd1b..ec2453e 100644 (file)
@@ -3380,6 +3380,7 @@ aac_handle_aif(struct aac_softc *sc, struct aac_fib *fib)
                /* token may have been lost */
                /* Wakeup any poll()ers */
                selwakeup(&sc->rcv_select);
+               KNOTE(&sc->rcv_select.si_note, 0);
                /* token may have been lost */
        }
        AAC_LOCK_RELEASE(&sc->aac_aifq_lock);
index 4fa3d6d..460fd57 100644 (file)
@@ -1635,6 +1635,7 @@ static void stl_start(struct tty *tp)
                        wakeup(&tp->t_outq);
                }
                selwakeup(&tp->t_wsel);
+               KNOTE(&tp->t_wsel.si_note, 0);
        }
 #endif
 
index ddde409..6500412 100644 (file)
@@ -1671,6 +1671,7 @@ static void stli_start(struct tty *tp)
                        wakeup(&tp->t_outq);
                }
                selwakeup(&tp->t_wsel);
+               KNOTE(&tp->t_wsel.si_note, 0);
        }
 #endif
 
index 1581806..a6ae308 100644 (file)
@@ -45,8 +45,10 @@ static void
 sndbuf_seltask(void *context, int pending)
 {
        struct snd_dbuf *b = context;
+       struct selinfo *si = sndbuf_getsel(b);
 
-       selwakeup(sndbuf_getsel(b));
+       selwakeup(si);
+       KNOTE(&si->si_note, 0);
 }
 
 struct snd_dbuf *
index 3500f83..3df457e 100644 (file)
@@ -875,6 +875,7 @@ ucomstart(struct tty *tp)
                        wakeup(TSA_OLOWAT(tp));
                }
                selwakeup(&tp->t_wsel);
+               KNOTE(&tp->t_wsel.si_note, 0);
                if (tp->t_outq.c_cc == 0) {
                        if (ISSET(tp->t_state, TS_BUSY | TS_SO_OCOMPLETE) ==
                            TS_SO_OCOMPLETE && tp->t_outq.c_cc == 0) {
index 58f2d0e..4f02193 100644 (file)
@@ -915,6 +915,7 @@ ugen_detach(device_t self)
                        if (sce && sce->pipeh)
                                usbd_abort_pipe(sce->pipeh);
                        selwakeup(&sce->rsel);
+                       KNOTE(&sce->rsel.si_note, 0);
                }
        }
        crit_enter();
@@ -969,6 +970,7 @@ ugenintr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status)
                wakeup(sce);
        }
        selwakeup(&sce->rsel);
+       KNOTE(&sce->rsel.si_note, 0);
 }
 
 static void
@@ -1029,6 +1031,7 @@ ugen_isoc_rintr(usbd_xfer_handle xfer, usbd_private_handle addr,
                wakeup(sce);
        }
        selwakeup(&sce->rsel);
+       KNOTE(&sce->rsel.si_note, 0);
 }
 
 static usbd_status
index 16243e8..a49a36d 100644 (file)
@@ -334,6 +334,7 @@ uhid_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status)
                wakeup(&sc->sc_q);
        }
        selwakeup(&sc->sc_rsel);
+       KNOTE(&sc->sc_rsel.si_note, 0);
        if (sc->sc_async != NULL) {
                DPRINTFN(3, ("uhid_intr: sending SIGIO %p\n", sc->sc_async));
                ksignal(sc->sc_async, SIGIO);
index 4722826..40492ad 100644 (file)
@@ -717,7 +717,7 @@ common_bktr_intr( void *arg )
                if (bktr->vbi_select.si_pid) {
                        selwakeup(&bktr->vbi_select);
                }
-
+               KNOTE(&bktr->vbi_select.si_note, 0);
 
        }
        UNLOCK_VBI(bktr);
index cac3903..1c608cc 100644 (file)
@@ -1371,6 +1371,7 @@ cxm_encoder_dma_done(struct cxm_softc *sc)
 
        /* wakeup anyone polling for data */
        selwakeup(&sc->enc_sel);
+       KNOTE(&sc->enc_sel.si_note, 0);
 }
 
 
index 010bebf..fe1339d 100644 (file)
@@ -423,6 +423,7 @@ udev_event_insert(int ev_type, prop_dictionary_t dict)
 
        wakeup(&udevctx);
        selwakeup(&udevctx.sel);
+       KNOTE(&udevctx.sel.si_note, 0);
 }
 
 static struct udev_event_kernel *
index 534b7aa..baff226 100644 (file)
@@ -368,6 +368,7 @@ devctl_queue_data(char *data)
        lockmgr(&devsoftc.lock, LK_RELEASE);
        get_mplock();   /* XXX */
        selwakeup(&devsoftc.sel);
+       KNOTE(&devsoftc.sel.si_note, 0);
        rel_mplock();   /* XXX */
        p = devsoftc.async_proc;
        if (p != NULL)
index 46ac56e..6de6e59 100644 (file)
@@ -224,6 +224,7 @@ logtimeout(void *arg)
        }
        msgbuftrigger = 0;
        selwakeup(&logsoftc.sc_selp);
+       KNOTE(&logsoftc.sc_selp.si_note, 0);
        if ((logsoftc.sc_state & LOG_ASYNC) && logsoftc.sc_sigio != NULL)
                pgsigio(logsoftc.sc_sigio, SIGIO, 0);
        if (logsoftc.sc_state & LOG_RDWAIT) {
index 56ba8af..61da303 100644 (file)
@@ -638,6 +638,7 @@ mq_receive1(struct lwp *l, mqd_t mqdes, void *msg_ptr, size_t msg_len,
        /* Ready for sending now */
        get_mplock();
        selwakeup(&mq->mq_wsel);
+       KNOTE(&mq->mq_wsel.si_note, 0);
        rel_mplock();
 error:
        lockmgr(&mq->mq_mtx, LK_RELEASE);
@@ -829,6 +830,7 @@ mq_send1(struct lwp *l, mqd_t mqdes, const char *msg_ptr, size_t msg_len,
        /* Ready for receiving now */
        get_mplock();
        selwakeup(&mq->mq_rsel);
+       KNOTE(&mq->mq_rsel.si_note, 0);
        rel_mplock();
 error:
        lockmgr(&mq->mq_mtx, LK_RELEASE);
@@ -1055,6 +1057,8 @@ sys_mq_unlink(struct mq_unlink_args *uap)
        get_mplock();
        selwakeup(&mq->mq_rsel);
        selwakeup(&mq->mq_wsel);
+       KNOTE(&mq->mq_rsel.si_note, 0);
+       KNOTE(&mq->mq_wsel.si_note, 0);
        rel_mplock();
 
        refcnt = mq->mq_refcnt;
index 456ca3b..e5ba0fa 100644 (file)
@@ -522,6 +522,7 @@ bpf_wakeup(struct bpf_d *d)
 
        get_mplock();
        selwakeup(&d->bd_sel);
+       KNOTE(&d->bd_sel.si_note, 0);
        rel_mplock();
        /* XXX */
        d->bd_sel.si_pid = 0;
index bb6db28..7a3956b 100644 (file)
@@ -813,6 +813,7 @@ rbch_rx_data_rdy(int unit)
                NDBGL4(L4_RBCHDBG, "unit %d, NO wakeup", unit);
        }
        selwakeup(&rbch_softc[unit].selp);
+       KNOTE(&rbch_softc[unit].selp.si_note, 0);
 }
 
 /*---------------------------------------------------------------------------*
@@ -834,6 +835,7 @@ rbch_tx_queue_empty(int unit)
                NDBGL4(L4_RBCHDBG, "unit %d, NO wakeup", unit);
        }
        selwakeup(&rbch_softc[unit].selp);
+       KNOTE(&rbch_softc[unit].selp.si_note, 0);
 }
 
 /*---------------------------------------------------------------------------*
@@ -846,6 +848,7 @@ rbch_activity(int unit, int rxtx)
        if (rbch_softc[unit].sc_cd)
                rbch_softc[unit].sc_cd->last_active_time = SECOND;
        selwakeup(&rbch_softc[unit].selp);
+       KNOTE(&rbch_softc[unit].selp.si_note, 0);
 }
 
 /*---------------------------------------------------------------------------*
index b9b5a67..7b276d5 100644 (file)
@@ -854,6 +854,7 @@ tel_connect(int unit, void *cdp)
                        wakeup((caddr_t) &sc->result);
                }
                selwakeup(&sc->selp);
+               KNOTE(&sc->selp.si_note, 0);
        }
 }
 
@@ -897,6 +898,7 @@ tel_disconnect(int unit, void *cdp)
                        wakeup((caddr_t) &sc->result);
                }
                selwakeup(&sc->selp);
+               KNOTE(&sc->selp.si_note, 0);
 
                if (sc->devstate & ST_TONE) {
                        sc->devstate &= ~ST_TONE;
@@ -925,6 +927,7 @@ tel_dialresponse(int unit, int status, cause_t cause)
                        wakeup((caddr_t) &sc->result);
                }
                selwakeup(&sc->selp);
+               KNOTE(&sc->selp.si_note, 0);
        }
 }
        
@@ -952,6 +955,7 @@ tel_rx_data_rdy(int unit)
                wakeup((caddr_t) &sc->isdn_linktab->rx_queue);
        }
        selwakeup(&sc->selp);
+       KNOTE(&sc->selp.si_note, 0);
 }
 
 /*---------------------------------------------------------------------------*
@@ -973,6 +977,7 @@ tel_tx_queue_empty(int unit)
                tel_tone(sc);
        } else {
                selwakeup(&sc->selp);
+               KNOTE(&sc->selp.si_note, 0);
        }
 }
 
index 2577f44..6dbf67f 100644 (file)
@@ -830,6 +830,7 @@ i4bputqueue(struct mbuf *m)
        }
 
        selwakeup(&select_rd_info);
+       KNOTE(&select_rd_info.si_note, 0);
 }
 
 /*---------------------------------------------------------------------------*
@@ -865,6 +866,7 @@ i4bputqueue_hipri(struct mbuf *m)
        }
 
        selwakeup(&select_rd_info);
+       KNOTE(&select_rd_info.si_note, 0);
 }
 
 #endif /* NI4B > 0 */
index d223625..732c64d 100644 (file)
@@ -429,6 +429,7 @@ tapclose(struct dev_close_args *ap)
        funsetown(tp->tap_sigio);
        tp->tap_sigio = NULL;
        selwakeup(&tp->tap_rsel);
+       KNOTE(&tp->tap_rsel.si_note, 0);
 
        tp->tap_flags &= ~TAP_OPEN;
        funsetown(tp->tap_sigtd);
index 8f6ab09..c72ad37 100644 (file)
@@ -219,6 +219,7 @@ tunclose(struct dev_close_args *ap)
 
        funsetown(tp->tun_sigio);
        selwakeup(&tp->tun_rsel);
+       KNOTE(&tp->tun_rsel.si_note, 0);
 
        TUNDEBUG(ifp, "closed\n");
 #if 0
@@ -398,6 +399,7 @@ tunoutput_serialized(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
                if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio)
                        pgsigio(tp->tun_sigio, SIGIO, 0);
                selwakeup(&tp->tun_rsel);
+               KNOTE(&tp->tun_rsel.si_note, 0);
                rel_mplock();
        }
        return (error);
@@ -797,5 +799,6 @@ tunstart(struct ifnet *ifp)
                if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio)
                        pgsigio(tp->tun_sigio, SIGIO, 0);
                selwakeup(&tp->tun_rsel);
+               KNOTE(&tp->tun_rsel.si_note, 0);
        }
 }
index e4c0980..97775b2 100644 (file)
@@ -905,6 +905,7 @@ apm_record_event(struct apm_softc *sc, u_int event_type)
        evp->type = event_type;
        evp->index = ++apm_evindex;
        selwakeup(&sc->sc_rsel);
+       KNOTE(&sc->sc_rsel.si_note, 0);
        return (sc->sc_flags & SCFLAG_OCTL) ? 0 : 1; /* user may handle */
 }
 
index 47421a7..b65f6fa 100644 (file)
@@ -525,6 +525,7 @@ ascintr(void *arg)
            scu->selp.si_pid=(pid_t)0;
            scu->selp.si_flags = 0;
        }
+       KNOTE(&scu->selp.si_note, 0);
     }
 }
 
index a77e830..5f80cca 100644 (file)
@@ -905,6 +905,7 @@ apm_record_event(struct apm_softc *sc, u_int event_type)
        evp->type = event_type;
        evp->index = ++apm_evindex;
        selwakeup(&sc->sc_rsel);
+       KNOTE(&sc->sc_rsel.si_note, 0);
        return (sc->sc_flags & SCFLAG_OCTL) ? 0 : 1; /* user may handle */
 }
 
index cd2789f..e8b3c11 100644 (file)
@@ -524,6 +524,7 @@ ascintr(void *arg)
            scu->selp.si_pid=(pid_t)0;
            scu->selp.si_flags = 0;
        }
+       KNOTE(&scu->selp.si_note, 0);
     }
 }