summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2001-03-01 20:54:37 +0000
committerNiels Provos <provos@cvs.openbsd.org>2001-03-01 20:54:37 +0000
commit950a6333d90c04783291b2f77e89257bc6df966e (patch)
tree0d452c7deda41df938a0f8d009e3f850249b8eb8 /sys/dev
parent9027db9730b3cc9c6f973b4e6fbdf6b353260158 (diff)
port kqueue changes from freebsd, plus all required openbsd glue.
okay deraadt@, millert@ from jlemon@freebsd.org: extend kqueue down to the device layer, backwards compatible approach suggested by peter@freebsd.org
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/cons.c19
-rw-r--r--sys/dev/cons.h5
-rw-r--r--sys/dev/wscons/wsdisplay.c21
3 files changed, 42 insertions, 3 deletions
diff --git a/sys/dev/cons.c b/sys/dev/cons.c
index f2a017da15a..78700bfa8ed 100644
--- a/sys/dev/cons.c
+++ b/sys/dev/cons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cons.c,v 1.8 2001/02/09 20:48:24 mickey Exp $ */
+/* $OpenBSD: cons.c,v 1.9 2001/03/01 20:54:32 provos Exp $ */
/* $NetBSD: cons.c,v 1.30 1996/04/08 19:57:30 jonathan Exp $ */
/*
@@ -227,6 +227,23 @@ cnselect(dev, rw, p)
return (ttselect(cn_tab->cn_dev, rw, p));
}
+
+int
+cnkqfilter(dev, kn)
+ dev_t dev;
+ struct knote *kn;
+{
+ if (constty != NULL && (cn_tab == NULL || cn_tab->cn_pri != CN_REMOTE))
+ return 0;
+ if (cn_tab == NULL)
+ return (1);
+
+ dev = cn_tab->cn_dev;
+ if (cdevsw[major(dev)].d_type & D_KQFILTER)
+ return ((*cdevsw[major(dev)].d_kqfilter)(dev, kn));
+ return (1);
+}
+
int
cngetc()
{
diff --git a/sys/dev/cons.h b/sys/dev/cons.h
index b8e6a6a53a6..14adef8e9ae 100644
--- a/sys/dev/cons.h
+++ b/sys/dev/cons.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cons.h,v 1.6 1998/06/17 14:58:34 mickey Exp $ */
+/* $OpenBSD: cons.h,v 1.7 2001/03/01 20:54:33 provos Exp $ */
/* $NetBSD: cons.h,v 1.14 1996/03/14 19:08:35 christos Exp $ */
/*
@@ -72,6 +72,8 @@ struct consdev {
extern struct consdev constab[];
extern struct consdev *cn_tab;
+struct knote;
+
void cninit __P((void));
int cnset __P((dev_t));
int cnopen __P((dev_t, int, int, struct proc *));
@@ -80,6 +82,7 @@ int cnread __P((dev_t, struct uio *, int));
int cnwrite __P((dev_t, struct uio *, int));
int cnioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
int cnselect __P((dev_t, int, struct proc *));
+int cnkqfilter __P((dev_t, struct knote *));
int cngetc __P((void));
void cnputc __P((int));
void cnpollc __P((int));
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index bc9cf1bfa15..552c37a67c5 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.14 2001/02/25 23:24:19 aaron Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.15 2001/03/01 20:54:33 provos Exp $ */
/* $NetBSD: wsdisplay.c,v 1.37.4.1 2000/06/30 16:27:53 simonb Exp $ */
/*
@@ -1179,6 +1179,25 @@ wsdisplayselect(dev, events, p)
return (0);
}
+int
+wsdisplaykqfilter(dev, kn)
+ dev_t dev;
+ struct knote *kn;
+{
+ struct wsdisplay_softc *sc = wsdisplay_cd.cd_devs[WSDISPLAYUNIT(dev)];
+ struct wsscreen *scr;
+
+ if (ISWSDISPLAYCTL(dev))
+ return (1);
+
+ scr = sc->sc_scr[WSDISPLAYSCREEN(dev)];
+
+ if (WSSCREEN_HAS_TTY(scr))
+ return (ttkqfilter(dev, kn));
+ else
+ return (1);
+}
+
void
wsdisplaystart(tp)
struct tty *tp;