Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/kqueue]: src/sys/arch/i386/isa Add kqueue support.



details:   https://anonhg.NetBSD.org/src/rev/e65997a6ae7f
branches:  kqueue
changeset: 512409:e65997a6ae7f
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Sep 08 21:38:31 2001 +0000

description:
Add kqueue support.

diffstat:

 sys/arch/i386/isa/olms.c |  53 ++++++++++++++++++++++++++++++++++++++++++++++-
 sys/arch/i386/isa/omms.c |  53 ++++++++++++++++++++++++++++++++++++++++++++++-
 sys/arch/i386/isa/pms.c  |  53 ++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 153 insertions(+), 6 deletions(-)

diffs (213 lines):

diff -r 2694d3c1c925 -r e65997a6ae7f sys/arch/i386/isa/olms.c
--- a/sys/arch/i386/isa/olms.c  Sat Sep 08 20:53:27 2001 +0000
+++ b/sys/arch/i386/isa/olms.c  Sat Sep 08 21:38:31 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: olms.c,v 1.1 1999/01/23 15:05:39 drochner Exp $        */
+/*     $NetBSD: olms.c,v 1.1.24.1 2001/09/08 21:38:31 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1993, 1994 Charles M. Hannum.
@@ -358,7 +358,7 @@
                        sc->sc_state &= ~LMS_ASLP;
                        wakeup((caddr_t)sc);
                }
-               selwakeup(&sc->sc_rsel);
+               selnotify(&sc->sc_rsel, 0);
        }
 
        return -1;
@@ -384,3 +384,52 @@
        splx(s);
        return (revents);
 }
+
+static void
+filt_lmsrdetach(struct knote *kn)
+{
+       struct olms_softc *sc = (void *) kn->kn_hook;
+       int s;
+
+       s = spltty();
+       SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
+       splx(s);
+}
+
+static int
+filt_lmsread(struct knote *kn, long hint)
+{
+       struct olms_softc *sc = (void *) kn->kn_hook;
+
+       kn->kn_data = sc->sc_q.c_cc;
+       return (kn->kn_data > 0);
+}
+
+static const struct filterops lmsread_filtops =
+       { 1, NULL, filt_lmsrdetach, filt_lmsread };
+
+int
+lmskqfilter(dev_t dev, struct knote *kn)
+{
+       struct olms_softc *sc = olms_cd.cd_devs[LMSUNIT(dev)];
+       struct klist *klist;
+       int s;
+
+       switch (kn->kn_filter) {
+       case EVFILT_READ:
+               klist = &sc->sc_rsel.si_klist;
+               kn->kn_fop = &lmsread_filtops;
+               break;
+
+       default:
+               return (1);
+       }
+
+       kn->kn_hook = (void *) sc;
+
+       s = spltty();
+       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       splx(s);
+
+       return (0);
+}
diff -r 2694d3c1c925 -r e65997a6ae7f sys/arch/i386/isa/omms.c
--- a/sys/arch/i386/isa/omms.c  Sat Sep 08 20:53:27 2001 +0000
+++ b/sys/arch/i386/isa/omms.c  Sat Sep 08 21:38:31 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: omms.c,v 1.1 1999/01/23 15:05:39 drochner Exp $        */
+/*     $NetBSD: omms.c,v 1.1.24.1 2001/09/08 21:38:32 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1993, 1994 Charles M. Hannum.
@@ -353,7 +353,7 @@
                        sc->sc_state &= ~MMS_ASLP;
                        wakeup((caddr_t)sc);
                }
-               selwakeup(&sc->sc_rsel);
+               selnotify(&sc->sc_rsel, 0);
        }
 
        return -1;
@@ -379,3 +379,52 @@
        splx(s);
        return (revents);
 }
+
+static void
+filt_mmsrdetach(struct knote *kn)
+{
+       struct omms_softc *sc = (void *) kn->kn_hook;
+       int s;
+
+       s = spltty();
+       SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
+       splx(s);
+}
+
+static int
+filt_mmsread(struct knote *kn, long hint)
+{
+       struct omms_softc *sc = (void *) kn->kn_hook;
+
+       kn->kn_data = sc->sc_q.c_cc;
+       return (kn->kn_data > 0);
+}
+
+static const struct filterops mmsread_filtops =
+       { 1, NULL, filt_mmsrdetach, filt_mmsread };
+
+int
+mmskqfilter(dev_t dev, struct knote *kn)
+{
+       struct omms_softc *sc = omms_cd.cd_devs[MMSUNIT(dev)];
+       struct klist *klist;
+       int s;
+
+       switch (kn->kn_filter) {
+       case EVFILT_READ:
+               klist = &sc->sc_rsel.si_klist;
+               kn->kn_fop = &mmsread_filtops;
+               break;
+
+       default:
+               return (1);
+       }
+
+       kn->kn_hook = (void *) sc;
+
+       s = spltty();
+       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       splx(s);
+
+       return (0);
+}
diff -r 2694d3c1c925 -r e65997a6ae7f sys/arch/i386/isa/pms.c
--- a/sys/arch/i386/isa/pms.c   Sat Sep 08 20:53:27 2001 +0000
+++ b/sys/arch/i386/isa/pms.c   Sat Sep 08 21:38:31 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pms.c,v 1.47 2000/06/05 22:20:56 sommerfeld Exp $      */
+/*     $NetBSD: pms.c,v 1.47.8.1 2001/09/08 21:38:32 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1994, 1997 Charles M. Hannum.
@@ -639,7 +639,7 @@
                                sc->sc_state &= ~PMS_ASLP;
                                wakeup((caddr_t)sc);
                        }
-                       selwakeup(&sc->sc_rsel);
+                       selnotify(&sc->sc_rsel, 0);
                }
 
                break;
@@ -686,3 +686,52 @@
        splx(s);
        return (revents);
 }
+
+static void
+filt_pmsrdetach(struct knote *kn)
+{
+       struct opms_softc *sc = (void *) kn->kn_hook;
+       int s;
+
+       s = spltty();
+       SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
+       splx(s);
+}
+
+static int
+filt_pmsread(struct knote *kn, long hint)
+{
+       struct opms_softc *sc = (void *) kn->kn_hook;
+
+       kn->kn_data = sc->sc_q.c_cc;
+       return (kn->kn_data > 0);
+}
+
+static const struct filterops pmsread_filtops =
+       { 1, NULL, filt_pmsrdetach, filt_pmsread };
+
+int
+pmskqfilter(dev_t dev, struct knote *kn)
+{
+       struct opms_softc *sc = opms_cd.cd_devs[PMSUNIT(dev)];
+       struct klist *klist;
+       int s;
+
+       switch (kn->kn_filter) {
+       case EVFILT_READ:
+               klist = &sc->sc_rsel.si_klist;
+               kn->kn_fop = &pmsread_filtops;
+               break;
+
+       default:
+               return (1);
+       }
+
+       kn->kn_hook = (void *) sc;
+
+       s = spltty();
+       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       splx(s);
+
+       return (0);
+}



Home | Main Index | Thread Index | Old Index