Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/kqueue]: src/sys/arch/sparc/dev Add kqueue support (not yet compiled).
details: https://anonhg.NetBSD.org/src/rev/eea67c15d839
branches: kqueue
changeset: 512422:eea67c15d839
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sun Sep 09 06:27:31 2001 +0000
description:
Add kqueue support (not yet compiled).
diffstat:
sys/arch/sparc/dev/tctrl.c | 53 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 51 insertions(+), 2 deletions(-)
diffs (74 lines):
diff -r b227228b61eb -r eea67c15d839 sys/arch/sparc/dev/tctrl.c
--- a/sys/arch/sparc/dev/tctrl.c Sun Sep 09 06:07:25 2001 +0000
+++ b/sys/arch/sparc/dev/tctrl.c Sun Sep 09 06:27:31 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tctrl.c,v 1.12.4.1 2001/08/25 06:15:52 thorpej Exp $ */
+/* $NetBSD: tctrl.c,v 1.12.4.2 2001/09/09 06:27:31 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -663,7 +663,7 @@
sc->sc_event_ptr %= APM_NEVENTS;
evp->type = event_type;
evp->index = ++tctrl_apm_evindex;
- selwakeup(&sc->sc_rsel);
+ selnotify(&sc->sc_rsel, 0);
return(sc->sc_flags & TCTRL_APM_CTLOPEN) ? 0 : 1;
}
return(1);
@@ -1201,6 +1201,55 @@
return (revents);
}
+
+static void
+filt_tctrlrdetach(struct knote *kn)
+{
+ struct tctrl_softc *sc = (void *) kn->kn_hook;
+ int s;
+
+ s = splts102();
+ SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
+ splx(s);
+}
+
+static void
+filt_tctrlread(struct knote *kn, long hint)
+{
+ struct tctrl_softc *sc = (void *) kn->kn_hook;
+
+ kn->kn_data = sc->sc_event_count;
+ return (kn->kn_data > 0);
+}
+
+static const struct filterops tctrlread_filtops =
+ { 1, NULL, filt_tctrlrdetach, filt_tctrlread };
+
+int
+tctrlkqfilter(dev_t dev, struct knote *kn)
+{
+ struct tctrl_softc *sc = tctrl_cd.cd_devs[TCTRL_STD_DEV];
+ int s;
+
+ switch (kn->kn_filter) {
+ case EVFILT_READ:
+ klist = &sc->sc_rsel.si_klist;
+ kn->kn_fop = &tctrlread_filtops;
+ break;
+
+ default:
+ return (1);
+ }
+
+ kn->kn_hook = (void *) sc;
+
+ s = splts102();
+ SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+ splx(s);
+
+ return (0);
+}
+
/* DO NOT SET THIS OPTION */
#ifdef TADPOLE_BLINK
void
Home |
Main Index |
Thread Index |
Old Index