Source-Changes-HG archive

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

[src/kqueue]: src/sys/arch/pmax/dev Add kqueue support (not yet compiled).



details:   https://anonhg.NetBSD.org/src/rev/b227228b61eb
branches:  kqueue
changeset: 512421:b227228b61eb
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 09 06:07:25 2001 +0000

description:
Add kqueue support (not yet compiled).

diffstat:

 sys/arch/pmax/dev/fb_usrreq.c   |  53 ++++++++++++++++++++++++++++++++++++++-
 sys/arch/pmax/dev/px.c          |  56 +++++++++++++++++++++++++++++++++++++++-
 sys/arch/pmax/dev/qvss_compat.c |   8 ++--
 3 files changed, 110 insertions(+), 7 deletions(-)

diffs (180 lines):

diff -r d4a54f11ac5b -r b227228b61eb sys/arch/pmax/dev/fb_usrreq.c
--- a/sys/arch/pmax/dev/fb_usrreq.c     Sun Sep 09 05:40:03 2001 +0000
+++ b/sys/arch/pmax/dev/fb_usrreq.c     Sun Sep 09 06:07:25 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fb_usrreq.c,v 1.22 2001/07/07 14:21:00 simonb Exp $    */
+/*     $NetBSD: fb_usrreq.c,v 1.22.2.1 2001/09/09 06:07:25 thorpej Exp $       */
 
 /*ARGSUSED*/
 int
@@ -254,6 +254,57 @@
        return (revents);
 }
 
+static void
+filt_fbrdetach(struct knote *kn)
+{
+       struct fbinfo *fi = (void *) kn->kn_hook;
+       int s;
+
+       s = spltty();
+       SLIST_REMOVE(&fi->fi_selp.si_klist, kn, knote, kn_selnext);
+       splx(s);
+}
+
+static int
+filt_fbread(struct knote *kn, long hint)
+{
+       struct fbinfo *fi = (void *) kn->kn_hook;
+
+       if (fi->fi_fbu->scrInfo.qe.eHead == fi->fi_fbu->scrInfo.qe.eTail)
+               return (0);
+
+       kn->kn_data = 0;        /* XXXLUKEM (thorpej): what to put here? */
+       return (1);
+}
+
+static const struct filterops fbread_filtops =
+       { 1, NULL, filt_fbrdetach, filt_fbread };
+
+int
+fbkqfilter(dev_t dev, struct knote *kn)
+{
+       struct fbinfo *fi = fbdevs[minor(dev)];
+       struct klist *klist;
+       int s;
+
+       switch (kn->kn_filter) {
+       case EVFILT_READ:
+               klist = &fi->fi_selp.si_klist;
+               kn->kn_fop = &fbread_filtops;
+               break;
+
+       default:
+               return (1);
+       }
+
+       kn->kn_hook = (void *) fi;
+
+       s = spltty();
+       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       splx(s);
+
+       return (0);
+}
 
 /*
  * Return the physical page number that corresponds to byte offset 'off'.
diff -r d4a54f11ac5b -r b227228b61eb sys/arch/pmax/dev/px.c
--- a/sys/arch/pmax/dev/px.c    Sun Sep 09 05:40:03 2001 +0000
+++ b/sys/arch/pmax/dev/px.c    Sun Sep 09 06:07:25 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: px.c,v 1.35 2001/07/07 14:21:00 simonb Exp $   */
+/*     $NetBSD: px.c,v 1.35.2.1 2001/09/09 06:07:25 thorpej Exp $      */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: px.c,v 1.35 2001/07/07 14:21:00 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: px.c,v 1.35.2.1 2001/09/09 06:07:25 thorpej Exp $");
 
 /*
  * px.c: driver for the DEC TURBOchannel 2D and 3D accelerated framebuffers
@@ -1874,6 +1874,58 @@
        return (revents);
 }
 
+static void
+filt_pxrdetach(struct knote *kn)
+{
+       struct fbinfo *fi = (void *) kn->kn_hook;
+       int s;
+
+       s = spltty();
+       SLIST_REMOVE(&fi->fi_selp.si_klist, kn, knote, kn_selnext);
+       splx(s);
+}
+
+static int
+filt_pxread(struct knote *kn, long hint)
+{
+       struct fbinfo *fi = (void *) kn->kn_hook;
+
+       if (fi->fi_fbu->scrInfo.qe.eHead == fi->fi_fbu->scrInfo.qe.eTail)
+               return (0);
+
+       kn->kn_data = 0;        /* XXXLUKEM (thorpej): what to put here? */
+       return (1);
+}
+
+static const struct filterops pxread_filtops =
+       { 1, NULL, filt_pxrdetach, filt_pxread };
+
+int
+pxkqfilter(dev_t dev, struct knote *kn)
+{
+       struct fbinfo *fi = &px_unit[minor(dev)]->pxi_fbinfo;
+       struct klist *klist;
+       int s;
+
+       switch (kn->kn_filter) {
+       case EVFILT_READ:
+               klist = &fi->fi_selp.si_klist;
+               kn->kn_fop = &pxread_filtops;
+               break;
+
+       default:
+               return (1);
+       }
+
+       kn->kn_hook = (void *) fi;
+
+       s = spltty();
+       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       splx(s);
+
+       return (0);;
+}
+
 paddr_t
 pxmmap(dev, off, prot)
        dev_t dev;
diff -r d4a54f11ac5b -r b227228b61eb sys/arch/pmax/dev/qvss_compat.c
--- a/sys/arch/pmax/dev/qvss_compat.c   Sun Sep 09 05:40:03 2001 +0000
+++ b/sys/arch/pmax/dev/qvss_compat.c   Sun Sep 09 06:07:25 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: qvss_compat.c,v 1.27 2001/07/07 14:21:00 simonb Exp $  */
+/*     $NetBSD: qvss_compat.c,v 1.27.2.1 2001/09/09 06:07:25 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -228,7 +228,7 @@
        eventPtr->time = TO_MS(time);
        eventPtr->key = ch;
        fbu->scrInfo.qe.eTail = i;
-       selwakeup(&fi->fi_selp);
+       selnotify(&fi->fi_selp, 0);
 }
 
 /*
@@ -349,7 +349,7 @@
        eventPtr->y = fbu->scrInfo.mouse.y;
        eventPtr->device = MOUSE_DEVICE;
        fbu->scrInfo.qe.eTail = PM_EVROUND(fbu->scrInfo.qe.eTail + 1);
-       selwakeup(&fi->fi_selp);
+       selnotify(&fi->fi_selp, 0);
 }
 
 /*
@@ -428,7 +428,7 @@
                eventPtr->y = fbu->scrInfo.mouse.y;
                fbu->scrInfo.qe.eTail = i;
        }
-       selwakeup(&fi->fi_selp);
+       selnotify(&fi->fi_selp, 0);
 
        lastRep = *newRepPtr;
        fbu->scrInfo.mswitches = newSwitch;



Home | Main Index | Thread Index | Old Index