Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/kqueue]: src/sys/arch Add kqueue support (not compiled yet).
details: https://anonhg.NetBSD.org/src/rev/25562d761f91
branches: kqueue
changeset: 512416:25562d761f91
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sun Sep 09 02:39:42 2001 +0000
description:
Add kqueue support (not compiled yet).
diffstat:
sys/arch/arc/dev/opms.c | 61 +++++++++++++++++++++++++++++++++++++++++------
sys/arch/bebox/isa/lms.c | 53 ++++++++++++++++++++++++++++++++++++++++-
sys/arch/bebox/isa/mms.c | 53 ++++++++++++++++++++++++++++++++++++++++-
sys/arch/bebox/isa/pms.c | 53 ++++++++++++++++++++++++++++++++++++++++-
4 files changed, 206 insertions(+), 14 deletions(-)
diffs (299 lines):
diff -r 8f91f3c92677 -r 25562d761f91 sys/arch/arc/dev/opms.c
--- a/sys/arch/arc/dev/opms.c Sun Sep 09 02:30:07 2001 +0000
+++ b/sys/arch/arc/dev/opms.c Sun Sep 09 02:39:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opms.c,v 1.1 2001/06/13 15:05:43 soda Exp $ */
+/* $NetBSD: opms.c,v 1.1.4.1 2001/09/09 02:39:42 thorpej Exp $ */
/* $OpenBSD: pccons.c,v 1.22 1999/01/30 22:39:37 imp Exp $ */
/* NetBSD: pms.c,v 1.21 1995/04/18 02:25:18 mycroft Exp */
@@ -91,12 +91,8 @@
extern struct cfdriver opms_cd;
-int opmsopen __P((dev_t, int));
-int opmsclose __P((dev_t, int));
-int opmsread __P((dev_t, struct uio *, int));
-int opmsioctl __P((dev_t, u_long, caddr_t, int));
-int opmsselect __P((dev_t, int, struct proc *));
-int opmspoll __P((dev_t, int, struct proc *));
+cdev_decl(opms);
+
static __inline void pms_dev_cmd __P((u_char));
static __inline void pms_aux_cmd __P((u_char));
static __inline void pms_pit_cmd __P((u_char));
@@ -386,7 +382,7 @@
sc->sc_state &= ~PMS_ASLP;
wakeup((caddr_t)sc);
}
- selwakeup(&sc->sc_rsel);
+ selnotify(&sc->sc_rsel, 0);
}
break;
@@ -414,3 +410,52 @@
splx(s);
return (revents);
}
+
+static void
+filt_opmsrdetach(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_opmsread(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 opmsread_filtops =
+ { 1, NULL, filt_opmsrdetach, filt_opmsread };
+
+int
+opmskqfilter(dev_t dev, struct knote *kn)
+{
+ struct opms_softc *sc = opms_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 = &opmsread_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 8f91f3c92677 -r 25562d761f91 sys/arch/bebox/isa/lms.c
--- a/sys/arch/bebox/isa/lms.c Sun Sep 09 02:30:07 2001 +0000
+++ b/sys/arch/bebox/isa/lms.c Sun Sep 09 02:39:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lms.c,v 1.4 1998/08/15 03:02:35 mycroft Exp $ */
+/* $NetBSD: lms.c,v 1.4.26.1 2001/09/09 02:44:33 thorpej Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles M. Hannum.
@@ -354,7 +354,7 @@
sc->sc_state &= ~LMS_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_lmsrdetach(struct knote *kn)
+{
+ struct lms_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 lms_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 lms_softc *sc = lms_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 8f91f3c92677 -r 25562d761f91 sys/arch/bebox/isa/mms.c
--- a/sys/arch/bebox/isa/mms.c Sun Sep 09 02:30:07 2001 +0000
+++ b/sys/arch/bebox/isa/mms.c Sun Sep 09 02:39:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mms.c,v 1.5 1998/08/15 03:02:37 mycroft Exp $ */
+/* $NetBSD: mms.c,v 1.5.26.1 2001/09/09 02:44:33 thorpej Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles M. Hannum.
@@ -331,7 +331,7 @@
sc->sc_state &= ~MMS_ASLP;
wakeup((caddr_t)sc);
}
- selwakeup(&sc->sc_rsel);
+ selnotify(&sc->sc_rsel, 0);
}
return -1;
@@ -356,3 +356,52 @@
splx(s);
return (revents);
}
+
+static void
+filt_mmsrdetach(struct knote *kn)
+{
+ struct mms_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 mms_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 mms_softc *sc = mms_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 = &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 8f91f3c92677 -r 25562d761f91 sys/arch/bebox/isa/pms.c
--- a/sys/arch/bebox/isa/pms.c Sun Sep 09 02:30:07 2001 +0000
+++ b/sys/arch/bebox/isa/pms.c Sun Sep 09 02:39:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pms.c,v 1.6 1998/09/28 09:33:14 sakamoto Exp $ */
+/* $NetBSD: pms.c,v 1.6.26.1 2001/09/09 02:44:33 thorpej Exp $ */
/*-
* Copyright (c) 1994 Charles M. Hannum.
@@ -446,7 +446,7 @@
sc->sc_state &= ~PMS_ASLP;
wakeup((caddr_t)sc);
}
- selwakeup(&sc->sc_rsel);
+ selnotify(&sc->sc_rsel, 0);
}
break;
@@ -474,3 +474,52 @@
splx(s);
return (revents);
}
+
+static void
+filt_pmsrdetach(struct knote *kn)
+{
+ struct pms_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 pms_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 pms_softc *sc = pms_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 = &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