summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-07-28 21:44:42 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-07-28 21:44:42 +0000
commit3903ec1f48bbae92c39629cac0911966d41de3bb (patch)
tree049c4e7eb191b2a355a6801b4c161234eaa3ac60 /sys/kern
parent230a75587a06168d5d360de70253d641410dee76 (diff)
Add a dummy kqueue filter similar to seltrue and use it for anything
using seltrue for poll. Based on code from NetBSD. Also remove a stray duplicate lpt entry from loongson, from deraadt. ok tedu deraadt
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_event.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 9c94d337b31..6538129fa1f 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_event.c,v 1.36 2010/05/18 22:26:09 tedu Exp $ */
+/* $OpenBSD: kern_event.c,v 1.37 2010/07/28 21:44:41 nicm Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -95,6 +95,7 @@ void filt_timerexpire(void *knx);
int filt_timerattach(struct knote *kn);
void filt_timerdetach(struct knote *kn);
int filt_timer(struct knote *kn, long hint);
+void filt_seltruedetach(struct knote *kn);
struct filterops kqread_filtops =
{ 1, NULL, filt_kqdetach, filt_kqueue };
@@ -377,6 +378,35 @@ filt_seltrue(struct knote *kn, long hint)
return (1);
}
+/*
+ * This provides full kqfilter entry for device switch tables, which
+ * has same effect as filter using filt_seltrue() as filter method.
+ */
+void
+filt_seltruedetach(struct knote *kn)
+{
+ /* Nothing to do */
+}
+
+const struct filterops seltrue_filtops =
+ { 1, NULL, filt_seltruedetach, filt_seltrue };
+
+int
+seltrue_kqfilter(dev_t dev, struct knote *kn)
+{
+ switch (kn->kn_filter) {
+ case EVFILT_READ:
+ case EVFILT_WRITE:
+ kn->kn_fop = &seltrue_filtops;
+ break;
+ default:
+ return (EINVAL);
+ }
+
+ /* Nothing more to do */
+ return (0);
+}
+
int
sys_kqueue(struct proc *p, void *v, register_t *retval)
{