Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/kqueue]: src/sys Use the seltrue filter as appropriate (or, rather, as t...
details: https://anonhg.NetBSD.org/src/rev/a8ee00d935ee
branches: kqueue
changeset: 512399:a8ee00d935ee
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sat Sep 08 18:12:19 2001 +0000
description:
Use the seltrue filter as appropriate (or, rather, as the "poll"
entry points of these drivers indicate).
diffstat:
sys/dev/rnd.c | 23 +++++++++++++++--------
sys/dev/scsipi/ch.c | 14 +++++++++++---
sys/dev/usb/ugen.c | 29 +++++++++++++++++++++++++++--
sys/dev/usb/uhid.c | 10 +++++++++-
sys/net/if_tun.c | 10 +++++++++-
5 files changed, 71 insertions(+), 15 deletions(-)
diffs (214 lines):
diff -r 70123169b7eb -r a8ee00d935ee sys/dev/rnd.c
--- a/sys/dev/rnd.c Sat Sep 08 16:48:17 2001 +0000
+++ b/sys/dev/rnd.c Sat Sep 08 18:12:19 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rnd.c,v 1.22.2.1 2001/09/08 04:37:07 thorpej Exp $ */
+/* $NetBSD: rnd.c,v 1.22.2.2 2001/09/08 18:12:19 thorpej Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -694,7 +694,7 @@
}
static void
-filt_rndrdetach(struct knote *kn)
+filt_rnddetach(struct knote *kn)
{
int s;
@@ -716,8 +716,11 @@
return (0);
}
+static const struct filterops rnd_seltrue_filtops =
+ { 1, NULL, filt_rnddetach, filt_seltrue };
+
static const struct filterops rndread_filtops =
- { 1, NULL, filt_rndrdetach, filt_rndread };
+ { 1, NULL, filt_rnddetach, filt_rndread };
int
rndkqfilter(dev_t dev, struct knote *kn)
@@ -727,12 +730,16 @@
switch (kn->kn_filter) {
case EVFILT_READ:
- if (minor(dev) == RND_DEV_URANDOM) {
- /* Simulate "seltrue". */
- return (1);
- }
klist = &rnd_selq.si_klist;
- kn->kn_fop = &rndread_filtops;
+ if (minor(dev) == RND_DEV_URANDOM)
+ kn->kn_fop = &rnd_seltrue_filtops;
+ else
+ kn->kn_fop = &rndread_filtops;
+ break;
+
+ case EVFILT_WRITE:
+ klist = &rnd_selq.si_klist;
+ kn->kn_fop = &rnd_seltrue_filtops;
break;
default:
diff -r 70123169b7eb -r a8ee00d935ee sys/dev/scsipi/ch.c
--- a/sys/dev/scsipi/ch.c Sat Sep 08 16:48:17 2001 +0000
+++ b/sys/dev/scsipi/ch.c Sat Sep 08 18:12:19 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ch.c,v 1.46.2.2 2001/09/08 04:24:51 thorpej Exp $ */
+/* $NetBSD: ch.c,v 1.46.2.3 2001/09/08 18:12:20 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -467,7 +467,7 @@
}
static void
-filt_chrdetach(struct knote *kn)
+filt_chdetach(struct knote *kn)
{
struct ch_softc *sc = (void *) kn->kn_hook;
@@ -486,7 +486,10 @@
}
static const struct filterops chread_filtops =
- { 1, NULL, filt_chrdetach, filt_chread };
+ { 1, NULL, filt_chdetach, filt_chread };
+
+static const struct filterops chwrite_filtops =
+ { 1, NULL, filt_chdetach, filt_seltrue };
int
chkqfilter(dev_t dev, struct knote *kn)
@@ -500,6 +503,11 @@
kn->kn_fop = &chread_filtops;
break;
+ case EVFILT_WRITE:
+ klist = &sc->sc_selq.si_klist;
+ kn->kn_fop = &chwrite_filtops;
+ break;
+
default:
return (1);
}
diff -r 70123169b7eb -r a8ee00d935ee sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c Sat Sep 08 16:48:17 2001 +0000
+++ b/sys/dev/usb/ugen.c Sat Sep 08 18:12:19 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ugen.c,v 1.45.4.1 2001/09/08 06:09:11 thorpej Exp $ */
+/* $NetBSD: ugen.c,v 1.45.4.2 2001/09/08 18:12:20 thorpej Exp $ */
/* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */
/*
@@ -1351,6 +1351,9 @@
static const struct filterops ugenread_isoc_filtops =
{ 1, NULL, filt_ugenrdetach, filt_ugenread_isoc };
+static const struct filterops ugen_seltrue_filtops =
+ { 1, NULL, filt_ugenrdetach, filt_seltrue };
+
int
ugenkqfilter(dev_t dev, struct knote *kn)
{
@@ -1380,14 +1383,36 @@
kn->kn_fop = &ugenread_isoc_filtops;
break;
case UE_BULK:
- default:
/*
* We have no easy way of determining if a read will
* yield any data or a write will happen.
* So, emulate "seltrue".
*/
+ kn->kn_fop = &ugen_seltrue_filtops;
+ break;
+ default:
return (1);
+ }
+ break;
+
+ case EVFILT_WRITE:
+ klist = &sce->rsel.si_klist;
+ switch (sce->edesc->bmAttributes & UE_XFERTYPE) {
+ case UE_INTERRUPT:
+ case UE_ISOCHRONOUS:
+ /* XXX poll doesn't support this */
+ return (1);
+
+ case UE_BULK:
+ /*
+ * We have no easy way of determining if a read will
+ * yield any data or a write will happen.
+ * So, emulate "seltrue".
+ */
+ kn->kn_fop = &ugen_seltrue_filtops;
break;
+ default:
+ return (1);
}
break;
diff -r 70123169b7eb -r a8ee00d935ee sys/dev/usb/uhid.c
--- a/sys/dev/usb/uhid.c Sat Sep 08 16:48:17 2001 +0000
+++ b/sys/dev/usb/uhid.c Sat Sep 08 18:12:19 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhid.c,v 1.42.4.2 2001/09/08 05:44:23 thorpej Exp $ */
+/* $NetBSD: uhid.c,v 1.42.4.3 2001/09/08 18:12:21 thorpej Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhid.c,v 1.22 1999/11/17 22:33:43 n_hibma Exp $ */
/*
@@ -747,6 +747,9 @@
static const struct filterops uhidread_filtops =
{ 1, NULL, filt_uhidrdetach, filt_uhidread };
+static const struct filterops uhid_seltrue_filtops =
+ { 1, NULL, filt_uhidrdetach, filt_seltrue };
+
int
uhidkqfilter(dev_t dev, struct knote *kn)
{
@@ -765,6 +768,11 @@
kn->kn_fop = &uhidread_filtops;
break;
+ case EVFILT_WRITE:
+ klist = &sc->sc_rsel.si_klist;
+ kn->kn_fop = &uhid_seltrue_filtops;
+ break;
+
default:
return (1);
}
diff -r 70123169b7eb -r a8ee00d935ee sys/net/if_tun.c
--- a/sys/net/if_tun.c Sat Sep 08 16:48:17 2001 +0000
+++ b/sys/net/if_tun.c Sat Sep 08 18:12:19 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tun.c,v 1.43.2.4 2001/09/08 04:08:24 thorpej Exp $ */
+/* $NetBSD: if_tun.c,v 1.43.2.5 2001/09/08 18:12:21 thorpej Exp $ */
/*
* Copyright (c) 1988, Julian Onions <jpo%cs.nott.ac.uk@localhost>
@@ -723,6 +723,9 @@
static const struct filterops tunread_filtops =
{ 1, NULL, filt_tunrdetach, filt_tunread };
+static const struct filterops tun_seltrue_filtops =
+ { 1, NULL, filt_tunrdetach, filt_seltrue };
+
int
tunkqfilter(dev_t dev, struct knote *kn)
{
@@ -736,6 +739,11 @@
kn->kn_fop = &tunread_filtops;
break;
+ case EVFILT_WRITE:
+ klist = &tp->tun_rsel.si_klist;
+ kn->kn_fop = &tun_seltrue_filtops;
+ break;
+
default:
return (1);
}
Home |
Main Index |
Thread Index |
Old Index