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 yet compiled).
details: https://anonhg.NetBSD.org/src/rev/9e73a9382d55
branches: kqueue
changeset: 512424:9e73a9382d55
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sun Sep 09 18:48:41 2001 +0000
description:
Add kqueue support (not yet compiled).
diffstat:
sys/arch/amiga/dev/event.c | 60 +++++++++++++++++++++++++++++++++++++++++-
sys/arch/amiga/dev/event_var.h | 5 ++-
sys/arch/atari/dev/event.c | 60 +++++++++++++++++++++++++++++++++++++++++-
sys/arch/atari/dev/event_var.h | 5 ++-
sys/arch/x68k/dev/event.c | 60 +++++++++++++++++++++++++++++++++++++++++-
sys/arch/x68k/dev/event_var.h | 5 ++-
6 files changed, 186 insertions(+), 9 deletions(-)
diffs (291 lines):
diff -r f1c0e6b9438b -r 9e73a9382d55 sys/arch/amiga/dev/event.c
--- a/sys/arch/amiga/dev/event.c Sun Sep 09 18:15:05 2001 +0000
+++ b/sys/arch/amiga/dev/event.c Sun Sep 09 18:48:41 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: event.c,v 1.5 1996/10/11 21:12:43 mhitch Exp $ */
+/* $NetBSD: event.c,v 1.5.42.1 2001/09/09 18:48:41 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -167,3 +167,61 @@
splx(s);
return (revents);
}
+
+static void
+filt_evrdetach(struct knote *kn)
+{
+ struct evvar *ev = (void *) kn->kn_hook;
+ int s;
+
+ s = splev();
+ SLIST_REMOVE(&ev->ev_sel.si_klist, kn, knote, kn_selnext);
+ splx(s);
+}
+
+static int
+filt_evread(struct knote *kn, long hint)
+{
+ struct evvar *ev = (void *) kn->kn_hook;
+
+ if (ev->ev_get == ev->ev_put)
+ return (0);
+
+ if (ev->ev_get < ev->ev_put)
+ kn->kn_data = ev->ev_put - ev->ev_get;
+ else
+ kn->kn_data = (EV_QSIZE - ev->ev_get) +
+ ev->ev_put;
+
+ kn->kn_data *= sizeof(struct firm_event);
+
+ return (1);
+}
+
+static const struct filterops ev_filtops =
+ { 1, NULL, filt_evrdetach, filt_evread };
+
+int
+ev_kqfilter(struct evvar *ev, struct knote *kn)
+{
+ struct klist *klist;
+ int s;
+
+ switch (kn->kn_filter) {
+ case EVFILT_READ:
+ klist = &ev->ev_sel.si_klist;
+ kn->kn_fop = &wsevent_filtops;
+ break;
+
+ default:
+ return (1);
+ }
+
+ kn->kn_hook = (void *) ev;
+
+ s = splev();
+ SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+ splx(s);
+
+ return (0);
+}
diff -r f1c0e6b9438b -r 9e73a9382d55 sys/arch/amiga/dev/event_var.h
--- a/sys/arch/amiga/dev/event_var.h Sun Sep 09 18:15:05 2001 +0000
+++ b/sys/arch/amiga/dev/event_var.h Sun Sep 09 18:48:41 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: event_var.h,v 1.3 1996/10/11 21:12:46 mhitch Exp $ */
+/* $NetBSD: event_var.h,v 1.3.42.1 2001/09/09 18:48:42 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -68,7 +68,7 @@
#define splev() spltty()
#define EV_WAKEUP(ev) { \
- selwakeup(&(ev)->ev_sel); \
+ selnotify(&(ev)->ev_sel, 0); \
if ((ev)->ev_wanted) { \
(ev)->ev_wanted = 0; \
wakeup((caddr_t)(ev)); \
@@ -81,6 +81,7 @@
void ev_fini __P((struct evvar *));
int ev_read __P((struct evvar *, struct uio *, int));
int ev_poll __P((struct evvar *, int, struct proc *));
+int ev_kqfilter __P((struct evvar *, struct knote *));
/*
* PEVENT is set just above PSOCK, which is just above TTIPRI, on the
diff -r f1c0e6b9438b -r 9e73a9382d55 sys/arch/atari/dev/event.c
--- a/sys/arch/atari/dev/event.c Sun Sep 09 18:15:05 2001 +0000
+++ b/sys/arch/atari/dev/event.c Sun Sep 09 18:48:41 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: event.c,v 1.5 1996/10/08 23:40:40 thorpej Exp $ */
+/* $NetBSD: event.c,v 1.5.42.1 2001/09/09 18:48:42 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -166,3 +166,61 @@
splx(s);
return (revents);
}
+
+static void
+filt_evrdetach(struct knote *kn)
+{
+ struct evvar *ev = (void *) kn->kn_hook;
+ int s;
+
+ s = splev();
+ SLIST_REMOVE(&ev->ev_sel.si_klist, kn, knote, kn_selnext);
+ splx(s);
+}
+
+static int
+filt_evread(struct knote *kn, long hint)
+{
+ struct evvar *ev = (void *) kn->kn_hook;
+
+ if (ev->ev_get == ev->ev_put)
+ return (0);
+
+ if (ev->ev_get < ev->ev_put)
+ kn->kn_data = ev->ev_put - ev->ev_get;
+ else
+ kn->kn_data = (EV_QSIZE - ev->ev_get) +
+ ev->ev_put;
+
+ kn->kn_data *= sizeof(struct firm_event);
+
+ return (1);
+}
+
+static const struct filterops ev_filtops =
+ { 1, NULL, filt_evrdetach, filt_evread };
+
+int
+ev_kqfilter(struct evvar *ev, struct knote *kn)
+{
+ struct klist *klist;
+ int s;
+
+ switch (kn->kn_filter) {
+ case EVFILT_READ:
+ klist = &ev->ev_sel.si_klist;
+ kn->kn_fop = &wsevent_filtops;
+ break;
+
+ default:
+ return (1);
+ }
+
+ kn->kn_hook = (void *) ev;
+
+ s = splev();
+ SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+ splx(s);
+
+ return (0);
+}
diff -r f1c0e6b9438b -r 9e73a9382d55 sys/arch/atari/dev/event_var.h
--- a/sys/arch/atari/dev/event_var.h Sun Sep 09 18:15:05 2001 +0000
+++ b/sys/arch/atari/dev/event_var.h Sun Sep 09 18:48:41 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: event_var.h,v 1.2 1996/09/25 15:03:40 leo Exp $ */
+/* $NetBSD: event_var.h,v 1.2.42.1 2001/09/09 18:48:42 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -68,7 +68,7 @@
#define splev() spltty()
#define EV_WAKEUP(ev) { \
- selwakeup(&(ev)->ev_sel); \
+ selnotify(&(ev)->ev_sel, 0); \
if ((ev)->ev_wanted) { \
(ev)->ev_wanted = 0; \
wakeup((caddr_t)(ev)); \
@@ -81,6 +81,7 @@
void ev_fini __P((struct evvar *));
int ev_read __P((struct evvar *, struct uio *, int));
int ev_poll __P((struct evvar *, int, struct proc *));
+int ev_kqfilter __P((struct evvar *, struct knote *));
/*
* PEVENT is set just above PSOCK, which is just above TTIPRI, on the
diff -r f1c0e6b9438b -r 9e73a9382d55 sys/arch/x68k/dev/event.c
--- a/sys/arch/x68k/dev/event.c Sun Sep 09 18:15:05 2001 +0000
+++ b/sys/arch/x68k/dev/event.c Sun Sep 09 18:48:41 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: event.c,v 1.4 1996/11/27 14:40:46 oki Exp $ */
+/* $NetBSD: event.c,v 1.4.44.1 2001/09/09 18:48:42 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -165,3 +165,61 @@
splx(s);
return (revents);
}
+
+static void
+filt_evrdetach(struct knote *kn)
+{
+ struct evvar *ev = (void *) kn->kn_hook;
+ int s;
+
+ s = splev();
+ SLIST_REMOVE(&ev->ev_sel.si_klist, kn, knote, kn_selnext);
+ splx(s);
+}
+
+static int
+filt_evread(struct knote *kn, long hint)
+{
+ struct evvar *ev = (void *) kn->kn_hook;
+
+ if (ev->ev_get == ev->ev_put)
+ return (0);
+
+ if (ev->ev_get < ev->ev_put)
+ kn->kn_data = ev->ev_put - ev->ev_get;
+ else
+ kn->kn_data = (EV_QSIZE - ev->ev_get) +
+ ev->ev_put;
+
+ kn->kn_data *= sizeof(struct firm_event);
+
+ return (1);
+}
+
+static const struct filterops ev_filtops =
+ { 1, NULL, filt_evrdetach, filt_evread };
+
+int
+ev_kqfilter(struct evvar *ev, struct knote *kn)
+{
+ struct klist *klist;
+ int s;
+
+ switch (kn->kn_filter) {
+ case EVFILT_READ:
+ klist = &ev->ev_sel.si_klist;
+ kn->kn_fop = &wsevent_filtops;
+ break;
+
+ default:
+ return (1);
+ }
+
+ kn->kn_hook = (void *) ev;
+
+ s = splev();
+ SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+ splx(s);
+
+ return (0);
+}
diff -r f1c0e6b9438b -r 9e73a9382d55 sys/arch/x68k/dev/event_var.h
--- a/sys/arch/x68k/dev/event_var.h Sun Sep 09 18:15:05 2001 +0000
+++ b/sys/arch/x68k/dev/event_var.h Sun Sep 09 18:48:41 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: event_var.h,v 1.2 1997/10/10 12:54:02 oki Exp $ */
+/* $NetBSD: event_var.h,v 1.2.32.1 2001/09/09 18:48:43 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -66,7 +66,7 @@
#define splev() spltty()
#define EV_WAKEUP(ev) { \
- selwakeup(&(ev)->ev_sel); \
+ selnotify(&(ev)->ev_sel, 0); \
if ((ev)->ev_wanted) { \
(ev)->ev_wanted = 0; \
wakeup((caddr_t)(ev)); \
@@ -80,6 +80,7 @@
int ev_read __P((struct evvar *, struct uio *, int));
int ev_select __P((struct evvar *, int, struct proc *));
int ev_poll __P((struct evvar *, int, struct proc *));
+int ev_kqfilter __P((struct evvar *, struct knote *));
/*
* PEVENT is set just above PSOCK, which is just above TTIPRI, on the
Home |
Main Index |
Thread Index |
Old Index