Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/kqueue]: src/sys Add a filter which simulates seltrue() by setting kn->k...



details:   https://anonhg.NetBSD.org/src/rev/70123169b7eb
branches:  kqueue
changeset: 512398:70123169b7eb
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Sep 08 16:48:17 2001 +0000

description:
Add a filter which simulates seltrue() by setting kn->kn_data to 0,
and then saying "event is active".

diffstat:

 sys/kern/kern_event.c |  20 +++++++++++++++++++-
 sys/sys/event.h       |   4 +++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diffs (52 lines):

diff -r da46fee7f230 -r 70123169b7eb sys/kern/kern_event.c
--- a/sys/kern/kern_event.c     Sat Sep 08 06:09:11 2001 +0000
+++ b/sys/kern/kern_event.c     Sat Sep 08 16:48:17 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_event.c,v 1.1.1.1.2.6 2001/09/08 02:33:48 thorpej Exp $   */
+/*     $NetBSD: kern_event.c,v 1.1.1.1.2.7 2001/09/08 16:48:18 thorpej Exp $   */
 /*-
  * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon%FreeBSD.org@localhost>
  * All rights reserved.
@@ -456,6 +456,24 @@
 }
 
 /*
+ * filt_seltrue:
+ *
+ *     This filter "event" routine simulates seltrue().
+ */
+int
+filt_seltrue(struct knote *kn, long hint)
+{
+
+       /*
+        * We don't know how much data can be read/written,
+        * but we know that it *can* be.  This is about as
+        * good as select/poll does as well.
+        */
+       kn->kn_data = 0;
+       return (1);
+}
+
+/*
  * kqueue(2) system call.
  */
 int
diff -r da46fee7f230 -r 70123169b7eb sys/sys/event.h
--- a/sys/sys/event.h   Sat Sep 08 06:09:11 2001 +0000
+++ b/sys/sys/event.h   Sat Sep 08 16:48:17 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: event.h,v 1.1.1.1.2.3 2001/09/07 22:01:55 thorpej Exp $        */
+/*     $NetBSD: event.h,v 1.1.1.1.2.4 2001/09/08 16:48:17 thorpej Exp $        */
 /*-
  * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon%FreeBSD.org@localhost>
  * All rights reserved.
@@ -211,6 +211,8 @@
                    const struct filterops *filtops, int *retfilter);
 extern int     kfilter_unregister(const char *name);
 
+extern int     filt_seltrue(struct knote *kn, long hint);
+
 #else  /* !_KERNEL */
 
 #include <sys/cdefs.h>



Home | Main Index | Thread Index | Old Index