merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
This commit is contained in:
jdolecek 2002-10-23 09:10:23 +00:00
parent 3dae1c4857
commit e0cc03a09b
355 changed files with 6938 additions and 1029 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: advnops.c,v 1.63 2002/08/04 05:42:43 soren Exp $ */
/* $NetBSD: advnops.c,v 1.64 2002/10/23 09:10:23 jdolecek Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.63 2002/08/04 05:42:43 soren Exp $");
__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.64 2002/10/23 09:10:23 jdolecek Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -117,6 +117,7 @@ const struct vnodeopv_entry_desc adosfs_vnodeop_entries[] = {
{ &vop_fcntl_desc, adosfs_fcntl }, /* fcntl */
{ &vop_ioctl_desc, adosfs_ioctl }, /* ioctl */
{ &vop_poll_desc, adosfs_poll }, /* poll */
{ &vop_kqfilter_desc, genfs_kqfilter }, /* kqfilter */
{ &vop_revoke_desc, adosfs_revoke }, /* revoke */
{ &vop_mmap_desc, adosfs_mmap }, /* mmap */
{ &vop_fsync_desc, adosfs_fsync }, /* fsync */

View File

@ -1,4 +1,4 @@
/* $NetBSD: altq_conf.c,v 1.9 2002/09/22 20:09:15 jdolecek Exp $ */
/* $NetBSD: altq_conf.c,v 1.10 2002/10/23 09:10:25 jdolecek Exp $ */
/* $KAME: altq_conf.c,v 1.13 2002/01/29 10:16:01 kjc Exp $ */
/*
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: altq_conf.c,v 1.9 2002/09/22 20:09:15 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: altq_conf.c,v 1.10 2002/10/23 09:10:25 jdolecek Exp $");
#if defined(__FreeBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
@ -204,7 +204,7 @@ static struct cdevsw altq_cdevsw =
#if defined(__NetBSD__)
const struct cdevsw altq_cdevsw = {
altqopen, altqclose, noread, nowrite, altqioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter
};
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.2 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: mem.c,v 1.3 2002/10/23 09:10:25 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -65,7 +65,7 @@ dev_type_mmap(mmmmap);
const struct cdevsw mem_cdevsw = {
nullopen, nullclose, mmrw, mmrw, mmioctl,
nostop, notty, nopoll, mmmmap,
nostop, notty, nopoll, mmmmap, nokqfilter,
};
/*ARGSUSED*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: arcpp.c,v 1.5 2002/10/02 03:25:47 thorpej Exp $ */
/* $NetBSD: arcpp.c,v 1.6 2002/10/23 09:10:26 jdolecek Exp $ */
/*-
* Copyright (c) 2001 Ben Harris
@ -52,7 +52,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: arcpp.c,v 1.5 2002/10/02 03:25:47 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: arcpp.c,v 1.6 2002/10/23 09:10:26 jdolecek Exp $");
#include <sys/conf.h>
#include <sys/device.h>
@ -110,7 +110,7 @@ dev_type_write(arcppwrite);
const struct cdevsw arcpp_cdevsw = {
arcppopen, arcppclose, noread, arcppwrite, noioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
#define ARCPPUNIT(s) (minor(s) & 0x1f)

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.10 2002/10/02 03:31:58 thorpej Exp $ */
/* $NetBSD: fd.c,v 1.11 2002/10/23 09:10:27 jdolecek Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -281,7 +281,7 @@ const struct bdevsw fd_bdevsw = {
const struct cdevsw fd_cdevsw = {
fdopen, fdclose, fdread, fdwrite, fdioctl,
nostop, notty, nopoll, nommap, D_DISK
nostop, notty, nopoll, nommap, nokqfilter, D_DISK
};
void fdgetdisklabel __P((struct fd_softc *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: a12dc.c,v 1.9 2002/10/02 04:06:36 thorpej Exp $ */
/* $NetBSD: a12dc.c,v 1.10 2002/10/23 09:10:28 jdolecek Exp $ */
/* [Notice revision 2.2]
* Copyright (c) 1997, 1998 Avalon Computer Systems, Inc.
@ -64,7 +64,7 @@
#ifndef BSIDE
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: a12dc.c,v 1.9 2002/10/02 04:06:36 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: a12dc.c,v 1.10 2002/10/23 09:10:28 jdolecek Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -117,7 +117,7 @@ dev_type_poll(a12dcpoll);
const struct cdevsw a12dc_cdevsw = {
a12dcopen, a12dcclose, a12dcread, a12dcwrite, a12dcioctl,
a12dcstop, a12dctty, a12dcpoll, nommap, D_TTY
a12dcstop, a12dctty, a12dcpoll, nommap, ttykqfilter, D_TTY
};
int a12dcfound; /* There Can Be Only One. */
@ -164,7 +164,7 @@ a12dcattach(parent, self, aux)
/* note that we've attached the chipset; can't have 2 A12Cs. */
a12dcfound = 1;
printf(": driver %s\n", "$Revision: 1.9 $");
printf(": driver %s\n", "$Revision: 1.10 $");
tp = a12dc_tty[0] = ttymalloc();
tp->t_oproc = a12dcstart;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.32 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: mem.c,v 1.33 2002/10/23 09:10:28 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -46,7 +46,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.32 2002/09/06 13:18:43 gehenna Exp $");
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.33 2002/10/23 09:10:28 jdolecek Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -72,7 +72,7 @@ dev_type_mmap(mmmmap);
const struct cdevsw mem_cdevsw = {
nullopen, nullclose, mmrw, mmrw, mmioctl,
nostop, notty, nopoll, mmmmap,
nostop, notty, nopoll, mmmmap, nokqfilter,
};
/*ARGSUSED*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: promcons.c,v 1.20 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: promcons.c,v 1.21 2002/10/23 09:10:29 jdolecek Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: promcons.c,v 1.20 2002/09/06 13:18:43 gehenna Exp $");
__KERNEL_RCSID(0, "$NetBSD: promcons.c,v 1.21 2002/10/23 09:10:29 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -64,7 +64,7 @@ dev_type_poll(prompoll);
const struct cdevsw prom_cdevsw = {
promopen, promclose, promread, promwrite, promioctl,
promstop, promtty, prompoll, nommap, D_TTY
promstop, promtty, prompoll, nommap, ttykqfilter, D_TTY
};
#define PROM_POLL_HZ 50

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.35 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: mem.c,v 1.36 2002/10/23 09:10:29 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.35 2002/09/06 13:18:43 gehenna Exp $");
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.36 2002/10/23 09:10:29 jdolecek Exp $");
/*
* Memory special file
@ -73,7 +73,7 @@ dev_type_ioctl(mmioctl);
const struct cdevsw mem_cdevsw = {
nullopen, nullclose, mmrw, mmrw, mmioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
/*ARGSUSED*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: event.c,v 1.7 2002/01/28 09:56:54 aymeric Exp $ */
/* $NetBSD: event.c,v 1.8 2002/10/23 09:10:30 jdolecek Exp $ */
/*
* Copyright (c) 1992, 1993
@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: event.c,v 1.7 2002/01/28 09:56:54 aymeric Exp $");
__KERNEL_RCSID(0, "$NetBSD: event.c,v 1.8 2002/10/23 09:10:30 jdolecek Exp $");
/*
* Internal `Firm_event' interface for the keyboard and mouse drivers.
@ -162,3 +162,61 @@ ev_poll(register struct evvar *ev, int events, struct proc *p)
splx(s);
return (revents);
}
static void
filt_evrdetach(struct knote *kn)
{
struct evvar *ev = 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 = 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 = &ev_filtops;
break;
default:
return (1);
}
kn->kn_hook = ev;
s = splev();
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
splx(s);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: event_var.h,v 1.4 2002/01/26 13:40:53 aymeric Exp $ */
/* $NetBSD: event_var.h,v 1.5 2002/10/23 09:10:30 jdolecek Exp $ */
/*
* Copyright (c) 1992, 1993
@ -68,7 +68,7 @@ struct evvar {
#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_init(struct evvar *);
void ev_fini(struct evvar *);
int ev_read(struct evvar *, struct uio *, int);
int ev_poll(struct evvar *, int, struct proc *);
int ev_kqfilter(struct evvar *, struct knote *);
/*
* PEVENT is set just above PSOCK, which is just above TTIPRI, on the

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.54 2002/10/02 04:55:49 thorpej Exp $ */
/* $NetBSD: fd.c,v 1.55 2002/10/23 09:10:31 jdolecek Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.54 2002/10/02 04:55:49 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.55 2002/10/23 09:10:31 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -257,7 +257,7 @@ const struct bdevsw fd_bdevsw = {
const struct cdevsw fd_cdevsw = {
fdopen, fdclose, fdread, fdwrite, fdioctl,
nostop, notty, nopoll, nommap, D_DISK
nostop, notty, nopoll, nommap, nokqfilter, D_DISK
};
struct dkdriver fddkdriver = { fdstrategy };

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf.c,v 1.45 2002/10/10 22:33:15 jdolecek Exp $ */
/* $NetBSD: grf.c,v 1.46 2002/10/23 09:10:32 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.45 2002/10/10 22:33:15 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.46 2002/10/23 09:10:32 jdolecek Exp $");
/*
* Graphics display driver for the Amiga
@ -105,7 +105,7 @@ dev_type_mmap(grfmmap);
const struct cdevsw grf_cdevsw = {
grfopen, grfclose, nullread, nullwrite, grfioctl,
nostop, notty, nopoll, grfmmap,
nostop, notty, nopoll, grfmmap, nokqfilter,
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.63 2002/10/02 04:55:51 thorpej Exp $ */
/* $NetBSD: ite.c,v 1.64 2002/10/23 09:10:32 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -50,7 +50,7 @@
#include "opt_ddb.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.63 2002/10/02 04:55:51 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.64 2002/10/23 09:10:32 jdolecek Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -169,7 +169,7 @@ dev_type_poll(itepoll);
const struct cdevsw ite_cdevsw = {
iteopen, iteclose, iteread, itewrite, iteioctl,
nostop, itetty, itepoll, nommap, D_TTY
nostop, itetty, itepoll, nommap, ttykqfilter, D_TTY
};
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: kbd.c,v 1.42 2002/10/02 04:55:52 thorpej Exp $ */
/* $NetBSD: kbd.c,v 1.43 2002/10/23 09:10:33 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.42 2002/10/02 04:55:52 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.43 2002/10/23 09:10:33 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -170,10 +170,11 @@ dev_type_close(kbdclose);
dev_type_read(kbdread);
dev_type_ioctl(kbdioctl);
dev_type_poll(kbdpoll);
dev_type_kqfilter(kbdkqfilter);
const struct cdevsw kbd_cdevsw = {
kbdopen, kbdclose, kbdread, nowrite, kbdioctl,
nostop, notty, kbdpoll, nommap,
nostop, notty, kbdpoll, nommap, kbdkqfilter,
};
/*ARGSUSED*/
@ -513,6 +514,14 @@ kbdpoll(dev_t dev, int events, struct proc *p)
return ev_poll (&kbd_softc.k_events, events, p);
}
int
kbdkqfilter(dev, kn)
dev_t dev;
struct knote *kn;
{
return (ev_kqfilter(&kbd_softc.k_events, kn));
}
void
kbdintr(int mask)

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfc.c,v 1.31 2002/10/02 04:55:52 thorpej Exp $ */
/* $NetBSD: mfc.c,v 1.32 2002/10/23 09:10:34 jdolecek Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
@ -37,7 +37,7 @@
#include "opt_kgdb.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mfc.c,v 1.31 2002/10/02 04:55:52 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: mfc.c,v 1.32 2002/10/23 09:10:34 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -230,7 +230,7 @@ dev_type_poll(mfcspoll);
const struct cdevsw mfcs_cdevsw = {
mfcsopen, mfcsclose, mfcsread, mfcswrite, mfcsioctl,
mfcsstop, mfcstty, mfcspoll, nommap, D_TTY
mfcsstop, mfcstty, mfcspoll, nommap, ttykqfilter, D_TTY
};
int mfcs_active;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ms.c,v 1.23 2002/10/02 04:55:52 thorpej Exp $ */
/* $NetBSD: ms.c,v 1.24 2002/10/23 09:10:34 jdolecek Exp $ */
/*
* based on:
@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.23 2002/10/02 04:55:52 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.24 2002/10/23 09:10:34 jdolecek Exp $");
/*
* Mouse driver.
@ -114,10 +114,11 @@ dev_type_close(msclose);
dev_type_read(msread);
dev_type_ioctl(msioctl);
dev_type_poll(mspoll);
dev_type_kqfilter(mskqfilter);
const struct cdevsw ms_cdevsw = {
msopen, msclose, msread, nowrite, msioctl,
nostop, notty, mspoll, nommap,
nostop, notty, mspoll, nommap, mskqfilter,
};
#define MS_UNIT(d) ((minor(d) & ~0x1) >> 1)
@ -446,3 +447,15 @@ mspoll(dev_t dev, int events, struct proc *p)
return(ev_poll(&ms->ms_events, events, p));
}
int
mskqfilter(dev, kn)
dev_t dev;
struct knote *kn;
{
struct ms_port *ms;
ms = MS_DEV2MSPORT(dev);
return (ev_kqfilter(&ms->ms_events, kn));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msc.c,v 1.25 2002/10/02 04:55:52 thorpej Exp $ */
/* $NetBSD: msc.c,v 1.26 2002/10/23 09:10:35 jdolecek Exp $ */
/*
* Copyright (c) 1993 Zik.
@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msc.c,v 1.25 2002/10/02 04:55:52 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: msc.c,v 1.26 2002/10/23 09:10:35 jdolecek Exp $");
#include "msc.h"
@ -186,7 +186,7 @@ dev_type_poll(mscpoll);
const struct cdevsw msc_cdevsw = {
mscopen, mscclose, mscread, mscwrite, mscioctl,
mscstop, msctty, mscpoll, nommap, D_TTY
mscstop, msctty, mscpoll, nommap, ttykqfilter, D_TTY
};
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: par.c,v 1.28 2002/10/02 04:55:52 thorpej Exp $ */
/* $NetBSD: par.c,v 1.29 2002/10/23 09:10:35 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1990 The Regents of the University of California.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: par.c,v 1.28 2002/10/02 04:55:52 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: par.c,v 1.29 2002/10/23 09:10:35 jdolecek Exp $");
/*
* parallel port interface
@ -119,7 +119,7 @@ dev_type_ioctl(parioctl);
const struct cdevsw par_cdevsw = {
paropen, parclose, parread, parwrite, parioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
/*ARGSUSED*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: ser.c,v 1.67 2002/10/02 04:55:52 thorpej Exp $ */
/* $NetBSD: ser.c,v 1.68 2002/10/23 09:10:36 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@ -44,7 +44,7 @@
#include "opt_kgdb.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ser.c,v 1.67 2002/10/02 04:55:52 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ser.c,v 1.68 2002/10/23 09:10:36 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -95,7 +95,7 @@ dev_type_poll(serpoll);
const struct cdevsw ser_cdevsw = {
seropen, serclose, serread, serwrite, serioctl,
serstop, sertty, serpoll, nommap, D_TTY
serstop, sertty, serpoll, nommap, ttykqfilter, D_TTY
};
#ifndef SEROBUF_SIZE

View File

@ -1,4 +1,4 @@
/* $NetBSD: view.c,v 1.23 2002/10/10 22:33:15 jdolecek Exp $ */
/* $NetBSD: view.c,v 1.24 2002/10/23 09:10:37 jdolecek Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -38,7 +38,7 @@
* a interface to graphics. */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: view.c,v 1.23 2002/10/10 22:33:15 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: view.c,v 1.24 2002/10/23 09:10:37 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -81,7 +81,7 @@ dev_type_mmap(viewmmap);
const struct cdevsw view_cdevsw = {
viewopen, viewclose, nullread, nullwrite, viewioctl,
nostop, notty, nopoll, viewmmap,
nostop, notty, nopoll, viewmmap, nokqfilter,
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: opms.c,v 1.4 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: opms.c,v 1.5 2002/10/23 09:10:38 jdolecek Exp $ */
/* $OpenBSD: pccons.c,v 1.22 1999/01/30 22:39:37 imp Exp $ */
/* NetBSD: pms.c,v 1.21 1995/04/18 02:25:18 mycroft Exp */
@ -101,7 +101,7 @@ dev_type_poll(opmspoll);
const struct cdevsw opms_cdevsw = {
opmsopen, opmsclose, opmsread, nowrite, opmsioctl,
nostop, notty, opmspoll, nommap,
nostop, notty, opmspoll, nommap, opmskqfilter,
};
static __inline void pms_dev_cmd __P((u_char));
@ -396,7 +396,7 @@ opmsintr(arg)
sc->sc_state &= ~PMS_ASLP;
wakeup((caddr_t)sc);
}
selwakeup(&sc->sc_rsel);
selnotify(&sc->sc_rsel, 0);
}
break;
@ -424,3 +424,52 @@ opmspoll(dev, events, p)
splx(s);
return (revents);
}
static void
filt_opmsrdetach(struct knote *kn)
{
struct opms_softc *sc = kn->kn_hook;
int s;
s = spltty();
SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
splx(s);
}
static int
filt_opmsread(struct knote *kn, long hint)
{
struct opms_softc *sc = kn->kn_hook;
kn->kn_data = sc->sc_q.c_cc;
return (kn->kn_data > 0);
}
static const struct filterops opmsread_filtops =
{ 1, NULL, filt_opmsrdetach, filt_opmsread };
int
opmskqfilter(dev_t dev, struct knote *kn)
{
struct opms_softc *sc = opms_cd.cd_devs[PMSUNIT(dev)];
struct klist *klist;
int s;
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &sc->sc_rsel.si_klist;
kn->kn_fop = &opmsread_filtops;
break;
default:
return (1);
}
kn->kn_hook = sc;
s = spltty();
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
splx(s);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pccons.c,v 1.30 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: pccons.c,v 1.31 2002/10/23 09:10:38 jdolecek Exp $ */
/* $OpenBSD: pccons.c,v 1.22 1999/01/30 22:39:37 imp Exp $ */
/* NetBSD: pccons.c,v 1.89 1995/05/04 19:35:20 cgd Exp */
@ -152,7 +152,7 @@ dev_type_mmap(pcmmap);
const struct cdevsw pc_cdevsw = {
pcopen, pcclose, pcread, pcwrite, pcioctl,
nostop, pctty, pcpoll, pcmmap, D_TTY
nostop, pctty, pcpoll, pcmmap, ttykqfilter, D_TTY
};
#define CHR 2

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.7 2002/10/02 04:59:48 thorpej Exp $ */
/* $NetBSD: fd.c,v 1.8 2002/10/23 09:10:40 jdolecek Exp $ */
/* $OpenBSD: fd.c,v 1.6 1998/10/03 21:18:57 millert Exp $ */
/* NetBSD: fd.c,v 1.78 1995/07/04 07:23:09 mycroft Exp */
@ -197,7 +197,7 @@ const struct bdevsw fd_bdevsw = {
const struct cdevsw fd_cdevsw = {
fdopen, fdclose, fdread, fdwrite, fdioctl,
nostop, notty, nopoll, nommap, D_DISK
nostop, notty, nopoll, nommap, nokqfilter, D_DISK
};
void fdgetdisklabel(struct fd_softc *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.7 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: mem.c,v 1.8 2002/10/23 09:10:40 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.7 2002/09/06 13:18:43 gehenna Exp $");
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.8 2002/10/23 09:10:40 jdolecek Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@ -68,7 +68,7 @@ dev_type_mmap(mmmmap);
const struct cdevsw mem_cdevsw = {
nullopen, nullclose, mmrw, mmrw, mmioctl,
nostop, notty, nopoll, mmmmap,
nostop, notty, nopoll, mmmmap, nokqfilter,
};
/*ARGSUSED*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: footbridge_com.c,v 1.8 2002/10/02 05:02:30 thorpej Exp $ */
/* $NetBSD: footbridge_com.c,v 1.9 2002/10/23 09:10:41 jdolecek Exp $ */
/*-
* Copyright (c) 1997 Mark Brinicombe
@ -129,7 +129,7 @@ dev_type_poll(fcompoll);
const struct cdevsw fcom_cdevsw = {
fcomopen, fcomclose, fcomread, fcomwrite, fcomioctl,
nostop, fcomtty, fcompoll, nommap, D_TTY
nostop, fcomtty, fcompoll, nommap, ttykqfilter, D_TTY
};
void fcominit __P((bus_space_tag_t, bus_space_handle_t, int, int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: beep.c,v 1.15 2002/10/02 15:45:11 thorpej Exp $ */
/* $NetBSD: beep.c,v 1.16 2002/10/23 09:10:42 jdolecek Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe
@ -42,7 +42,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: beep.c,v 1.15 2002/10/02 15:45:11 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: beep.c,v 1.16 2002/10/23 09:10:42 jdolecek Exp $");
#include <sys/systm.h>
#include <sys/conf.h>
@ -99,7 +99,7 @@ dev_type_ioctl(beepioctl);
const struct cdevsw beep_cdevsw = {
beepopen, beepclose, noread, nowrite, beepioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: console.c,v 1.9 2002/10/08 08:57:52 jdolecek Exp $ */
/* $NetBSD: console.c,v 1.10 2002/10/23 09:10:44 jdolecek Exp $ */
/*
* Copyright (c) 1994-1995 Melvyn Tang-Richardson
@ -145,7 +145,7 @@ dev_type_mmap(physconmmap);
const struct cdevsw physcon_cdevsw = {
physconopen, physconclose, physconread, physconwrite, physconioctl,
nostop, physcontty, physconpoll, physconmmap, D_TTY
nostop, physcontty, physconpoll, physconmmap, ttykqfilter, D_TTY
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidcconsole.c,v 1.8 2002/10/05 17:16:37 chs Exp $ */
/* $NetBSD: vidcconsole.c,v 1.9 2002/10/23 09:10:45 jdolecek Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
@ -114,7 +114,7 @@ dev_type_mmap(vidcconsolemmap);
const struct cdevsw vidcconsole_cdevsw = {
vidcconsoleopen, vidcconsoleclose, noread, nowrite, vidcconsoleioctl,
nostop, notty, nopoll, vidcconsolemmap,
nostop, notty, nopoll, vidcconsolemmap, nokqfilter,
};
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: iic.c,v 1.5 2002/09/27 03:17:44 thorpej Exp $ */
/* $NetBSD: iic.c,v 1.6 2002/10/23 09:10:42 jdolecek Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -51,6 +51,7 @@
#include <sys/conf.h>
#include <sys/malloc.h>
#include <sys/device.h>
#include <sys/event.h>
#include <machine/bus.h>
#include <machine/cpu.h>
@ -86,7 +87,7 @@ dev_type_close(iicclose);
const struct cdevsw iic_cdevsw = {
iicopen, iicclose, noread, nowrite, noioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: kbd.c,v 1.4 2002/10/22 20:20:35 jdolecek Exp $ */
/* $NetBSD: kbd.c,v 1.5 2002/10/23 09:10:42 jdolecek Exp $ */
/*
* Copyright (c) 1994-1997 Mark Brinicombe.
@ -156,7 +156,7 @@ dev_type_ioctl(kbdioctl);
const struct cdevsw kbd_cdevsw = {
kbdopen, kbdclose, kbdread, nowrite, kbdioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
/* keyboard commands */

View File

@ -1,4 +1,4 @@
/* $NetBSD: opms.c,v 1.2 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: opms.c,v 1.3 2002/10/23 09:10:43 jdolecek Exp $ */
/*-
* Copyright (c) 1996 D.C. Tsen
@ -41,7 +41,7 @@
#include <sys/param.h>
__RCSID("$NetBSD: opms.c,v 1.2 2002/09/06 13:18:43 gehenna Exp $");
__RCSID("$NetBSD: opms.c,v 1.3 2002/10/23 09:10:43 jdolecek Exp $");
#include <sys/kernel.h>
#include <sys/systm.h>
@ -94,10 +94,11 @@ dev_type_close(opmsclose);
dev_type_read(opmsread);
dev_type_ioctl(opmsioctl);
dev_type_poll(opmspoll);
dev_type_kqfilter(opmskqfilter);
const struct cdevsw opms_cdevsw = {
opmsopen, opmsclose, opmsread, nowrite, opmsioctl,
nostop, notty, opmspoll, nommap,
nostop, notty, opmspoll, nommap, opmskqfilter,
};
/* opms device driver structure */
@ -657,6 +658,54 @@ opmspoll(dev, events, p)
return (revents);
}
static void
filt_opmsrdetach(struct knote *kn)
{
struct opms_softc *sc = kn->kn_hook;
int s;
s = spltty();
SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
splx(s);
}
static int
filt_opmsread(struct knote *kn, long hint)
{
struct opms_softc *sc = kn->kn_hook;
kn->kn_data = sc->sc_q.c_cc;
return (kn->kn_data > 0);
}
static const struct filterops opmsread_filtops =
{ 1, NULL, filt_opmsrdetach, filt_opmsread };
int
opmskqfilter(dev_t dev, struct knote *kn)
{
struct opms_softc *sc = opms_cd.cd_devs[PMSUNIT(dev)];
struct klist *klist;
int s;
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &sc->sc_rsel.si_klist;
kn->kn_fop = &opmsread_filtops;
break;
default:
return (1);
}
kn->kn_hook = sc;
s = spltty();
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
splx(s);
return (0);
}
void
opmswatchdog(arg)

View File

@ -1,4 +1,4 @@
/* $NetBSD: qms.c,v 1.2 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: qms.c,v 1.3 2002/10/23 09:10:43 jdolecek Exp $ */
/*
* Copyright (c) Scott Stevens 1995 All rights reserved
@ -72,10 +72,11 @@ dev_type_close(qmsclose);
dev_type_read(qmsread);
dev_type_ioctl(qmsioctl);
dev_type_poll(qmspoll);
dev_type_kqfilter(qmskqfilter);
const struct cdevsw qms_cdevsw = {
qmsopen, qmsclose, qmsread, nowrite, qmsioctl,
nostop, notty, qmspoll, nommap,
nostop, notty, qmspoll, nommap, qmskqfilter,
};
/* qms device structure */
@ -477,4 +478,54 @@ qmsputbuffer(sc, buffer)
}
#endif
/* XXXLUKEM (jdolecek) kqueue hooks not tested */
static void
filt_qmsrdetach(struct knote *kn)
{
struct qms_softc *sc = kn->kn_hook;
int s;
s = spltty();
SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
splx(s);
}
static int
filt_qmsread(struct knote *kn, long hint)
{
struct qms_softc *sc = kn->kn_hook;
kn->kn_data = sc->sc_buffer.c_cc;
return (kn->kn_data > 0);
}
static const struct filterops qmsread_filtops =
{ 1, NULL, filt_qmsrdetach, filt_qmsread };
int
qmskqfilter(dev_t dev, struct knote *kn)
{
struct qms_softc *sc = qms_cd.cd_devs[minor(dev)];
struct klist *klist;
int s;
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &sc->sc_rsel.si_klist;
kn->kn_fop = &qmsread_filtops;
break;
default:
return (1);
}
kn->kn_hook = sc;
s = spltty();
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
splx(s);
return (0);
}
/* End of qms.c */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtc.c,v 1.8 2002/10/02 15:45:13 thorpej Exp $ */
/* $NetBSD: rtc.c,v 1.9 2002/10/23 09:10:43 jdolecek Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -50,6 +50,7 @@
#include <sys/conf.h>
#include <sys/malloc.h>
#include <sys/device.h>
#include <sys/event.h>
#include <machine/rtc.h>
#include <arm/iomd/iic.h>
#include <arm/iomd/todclockvar.h>
@ -260,7 +261,7 @@ dev_type_write(rtcwrite);
const struct cdevsw rtc_cdevsw = {
rtcopen, rtcclose, rtcread, rtcwrite, noioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ixp12x0_com.c,v 1.6 2002/10/09 00:06:57 thorpej Exp $ */
/* $NetBSD: ixp12x0_com.c,v 1.7 2002/10/23 09:10:46 jdolecek Exp $ */
/*
* Copyright (c) 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
* All rights reserved.
@ -154,7 +154,7 @@ dev_type_poll(ixpcompoll);
const struct cdevsw ixpcom_cdevsw = {
ixpcomopen, ixpcomclose, ixpcomread, ixpcomwrite, nullioctl,
ixpcomstop, ixpcomtty, ixpcompoll, nommap, D_TTY
ixpcomstop, ixpcomtty, ixpcompoll, nommap, ttykqfilter, D_TTY
};
struct consdev ixpcomcons = {

View File

@ -1,4 +1,4 @@
/* $NetBSD: sa11x0_com.c,v 1.11 2002/10/05 17:12:10 chs Exp $ */
/* $NetBSD: sa11x0_com.c,v 1.12 2002/10/23 09:10:47 jdolecek Exp $ */
/*-
* Copyright (c) 1998, 1999, 2001 The NetBSD Foundation, Inc.
@ -122,7 +122,7 @@ dev_type_poll(sacompoll);
const struct cdevsw sacom_cdevsw = {
sacomopen, sacomclose, sacomread, sacomwrite, sacomioctl,
sacomstop, sacomtty, sacompoll, nommap, D_TTY
sacomstop, sacomtty, sacompoll, nommap, ttykqfilter, D_TTY
};
static int sacom_match(struct device *, struct cfdata *, void *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.26 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: mem.c,v 1.27 2002/10/23 09:10:48 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -70,7 +70,7 @@ dev_type_ioctl(mmioctl);
const struct cdevsw mem_cdevsw = {
nullopen, nullclose, mmrw, mmrw, mmioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
/*ARGSUSED*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.30 2002/10/02 05:04:25 thorpej Exp $ */
/* $NetBSD: clock.c,v 1.31 2002/10/23 09:10:48 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -48,6 +48,7 @@
#include <sys/device.h>
#include <sys/uio.h>
#include <sys/conf.h>
#include <sys/event.h>
#include <dev/clock_subr.h>
@ -103,7 +104,7 @@ extern struct cfdriver clock_cd;
const struct cdevsw rtc_cdevsw = {
rtcopen, rtcclose, rtcread, rtcwrite, noioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
void statintr __P((struct clockframe));

View File

@ -1,4 +1,4 @@
/* $NetBSD: event.c,v 1.5 1996/10/08 23:40:40 thorpej Exp $ */
/* $NetBSD: event.c,v 1.6 2002/10/23 09:10:49 jdolecek Exp $ */
/*
* Copyright (c) 1992, 1993
@ -166,3 +166,61 @@ ev_poll(ev, events, p)
splx(s);
return (revents);
}
static void
filt_evrdetach(struct knote *kn)
{
struct evvar *ev = 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 = 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 = &ev_filtops;
break;
default:
return (1);
}
kn->kn_hook = ev;
s = splev();
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
splx(s);
return (0);
}

View File

@ -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.3 2002/10/23 09:10:50 jdolecek Exp $ */
/*
* Copyright (c) 1992, 1993
@ -68,7 +68,7 @@ struct evvar {
#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_init __P((struct evvar *));
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

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.42 2002/10/02 05:04:25 thorpej Exp $ */
/* $NetBSD: fd.c,v 1.43 2002/10/23 09:10:50 jdolecek Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman.
@ -276,7 +276,7 @@ const struct bdevsw fd_bdevsw = {
const struct cdevsw fd_cdevsw = {
fdopen, fdclose, fdread, fdwrite, fdioctl,
nostop, notty, nopoll, nommap, D_DISK
nostop, notty, nopoll, nommap, nokqfilter, D_DISK
};
static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf.c,v 1.30 2002/10/10 22:33:15 jdolecek Exp $ */
/* $NetBSD: grf.c,v 1.31 2002/10/23 09:10:51 jdolecek Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman
@ -110,7 +110,7 @@ dev_type_mmap(grfmmap);
const struct cdevsw grf_cdevsw = {
grfopen, grfclose, noread, nowrite, grfioctl,
nostop, notty, nopoll, grfmmap,
nostop, notty, nopoll, grfmmap, nokqfilter,
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: hdfd.c,v 1.33 2002/10/02 05:04:25 thorpej Exp $ */
/* $NetBSD: hdfd.c,v 1.34 2002/10/23 09:10:51 jdolecek Exp $ */
/*-
* Copyright (c) 1996 Leo Weppelman
@ -258,7 +258,7 @@ const struct bdevsw fd_bdevsw = {
const struct cdevsw fd_cdevsw = {
fdopen, fdclose, fdread, fdwrite, fdioctl,
nostop, notty, nopoll, nommap, D_DISK
nostop, notty, nopoll, nommap, nokqfilter, D_DISK
};
void fdstart __P((struct fd_softc *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.38 2002/10/02 05:04:25 thorpej Exp $ */
/* $NetBSD: ite.c,v 1.39 2002/10/23 09:10:52 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -164,7 +164,7 @@ dev_type_poll(itepoll);
const struct cdevsw ite_cdevsw = {
iteopen, iteclose, iteread, itewrite, iteioctl,
nostop, itetty, itepoll, nommap, D_TTY
nostop, itetty, itepoll, nommap, ttykqfilter, D_TTY
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: kbd.c,v 1.21 2002/10/02 05:04:26 thorpej Exp $ */
/* $NetBSD: kbd.c,v 1.22 2002/10/23 09:10:52 jdolecek Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman
@ -76,6 +76,7 @@ dev_type_close(kbdclose);
dev_type_read(kbdread);
dev_type_ioctl(kbdioctl);
dev_type_poll(kbdpoll);
dev_type_kqfilter(kbdkqfilter);
/* Interrupt handler */
void kbdintr __P((int));
@ -92,7 +93,7 @@ CFATTACH_DECL(kbd, sizeof(struct device),
const struct cdevsw kbd_cdevsw = {
kbdopen, kbdclose, kbdread, nowrite, kbdioctl,
nostop, notty, kbdpoll, nommap,
nostop, notty, kbdpoll, nommap, kbdkqfilter,
};
/*ARGSUSED*/
@ -266,6 +267,13 @@ kbdpoll (dev_t dev, int events, struct proc *p)
return ev_poll (&kbd_softc.k_events, events, p);
}
int
kbdkqfilter(dev_t dev, struct knote *kn)
{
return (ev_kqfilter(&kbd_softc.k_events, kn));
}
/*
* Keyboard interrupt handler called straight from MFP at spl6.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: lpt.c,v 1.21 2002/10/02 05:04:26 thorpej Exp $ */
/* $NetBSD: lpt.c,v 1.22 2002/10/23 09:10:52 jdolecek Exp $ */
/*
* Copyright (c) 1996 Leo Weppelman
@ -134,7 +134,7 @@ extern struct cfdriver lp_cd;
const struct cdevsw lp_cdevsw = {
lpopen, lpclose, noread, lpwrite, lpioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
/*ARGSUSED*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: ms.c,v 1.11 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: ms.c,v 1.12 2002/10/23 09:10:53 jdolecek Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman.
@ -89,10 +89,11 @@ dev_type_close(msclose);
dev_type_read(msread);
dev_type_ioctl(msioctl);
dev_type_poll(mspoll);
dev_type_kqfilter(mskqfilter);
const struct cdevsw ms_cdevsw = {
msopen, msclose, msread, nowrite, msioctl,
nostop, notty, mspoll, nommap,
nostop, notty, mspoll, nommap, mskqfilter,
};
static void ms_3b_delay __P((struct ms_softc *));
@ -424,4 +425,13 @@ struct proc *p;
ms = &ms_softc[minor(dev)];
return(ev_poll(&ms->ms_events, events, p));
}
int
mskqfilter(dev_t dev, struct knote *kn)
{
struct ms_softc *ms;
ms = &ms_softc[minor(dev)];
return (ev_kqfilter(&ms->ms_events, kn));
}
#endif /* NMOUSE > 0 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ser.c,v 1.20 2002/10/02 05:04:26 thorpej Exp $ */
/* $NetBSD: ser.c,v 1.21 2002/10/23 09:10:53 jdolecek Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -274,7 +274,7 @@ dev_type_poll(serpoll);
const struct cdevsw ser_cdevsw = {
seropen, serclose, serread, serwrite, serioctl,
serstop, sertty, serpoll, nommap, D_TTY
serstop, sertty, serpoll, nommap, ttykqfilter, D_TTY
};
/*ARGSUSED*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: view.c,v 1.20 2002/10/10 22:33:16 jdolecek Exp $ */
/* $NetBSD: view.c,v 1.21 2002/10/23 09:10:54 jdolecek Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -74,7 +74,7 @@ dev_type_mmap(viewmmap);
const struct cdevsw view_cdevsw = {
viewopen, viewclose, nullread, nullwrite, viewioctl,
nostop, notty, nopoll, viewmmap,
nostop, notty, nopoll, viewmmap, nokqfilter,
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: zs.c,v 1.38 2002/10/02 05:04:26 thorpej Exp $ */
/* $NetBSD: zs.c,v 1.39 2002/10/23 09:10:54 jdolecek Exp $ */
/*
* Copyright (c) 1995 L. Weppelman (Atari modifications)
@ -208,7 +208,7 @@ dev_type_poll(zspoll);
const struct cdevsw zs_cdevsw = {
zsopen, zsclose, zsread, zswrite, zsioctl,
zsstop, zstty, zspoll, nommap, D_TTY
zsstop, zstty, zspoll, nommap, ttykqfilter, D_TTY
};
/* Interrupt handlers. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: et4000.c,v 1.9 2002/10/02 05:04:27 thorpej Exp $ */
/* $NetBSD: et4000.c,v 1.10 2002/10/23 09:10:55 jdolecek Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@ -58,6 +58,7 @@
#include <sys/device.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/event.h>
#include <atari/vme/vmevar.h>
#include <machine/iomap.h>
@ -142,7 +143,7 @@ dev_type_mmap(etmmap);
const struct cdevsw et_cdevsw = {
etopen, etclose, etread, etwrite, etioctl,
nostop, notty, nopoll, etmmap,
nostop, notty, nopoll, etmmap, nokqfilter,
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: leo.c,v 1.7 2002/10/02 05:04:27 thorpej Exp $ */
/* $NetBSD: leo.c,v 1.8 2002/10/23 09:10:55 jdolecek Exp $ */
/*-
* Copyright (c) 1997 maximum entropy <entropy@zippy.bernstein.com>
@ -113,7 +113,7 @@ dev_type_mmap(leommap);
const struct cdevsw leo_cdevsw = {
leoopen, leoclose, leomove, leomove, leoioctl,
nostop, notty, nopoll, leommap,
nostop, notty, nopoll, leommap, nokqfilter,
};
static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: lms.c,v 1.8 2002/10/02 05:05:29 thorpej Exp $ */
/* $NetBSD: lms.c,v 1.9 2002/10/23 09:10:56 jdolecek Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles M. Hannum.
@ -85,10 +85,11 @@ dev_type_close(lmsclose);
dev_type_read(lmsread);
dev_type_ioctl(lmsioctl);
dev_type_poll(lmspoll);
dev_type_kqfilter(lmsqkfilter);
const struct cdevsw lms_cdevsw = {
lmsopen, lmsclose, lmsread, nowrite, lmsioctl,
nostop, notty, lmspoll, nommap,
nostop, notty, lmspoll, nommap, lmskqfilter,
};
#define LMSUNIT(dev) (minor(dev))
@ -364,7 +365,7 @@ lmsintr(arg)
sc->sc_state &= ~LMS_ASLP;
wakeup((caddr_t)sc);
}
selwakeup(&sc->sc_rsel);
selnotify(&sc->sc_rsel, 0);
}
return -1;
@ -389,3 +390,52 @@ lmspoll(dev, events, p)
splx(s);
return (revents);
}
static void
filt_lmsrdetach(struct knote *kn)
{
struct lms_softc *sc = kn->kn_hook;
int s;
s = spltty();
SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
splx(s);
}
static int
filt_lmsread(struct knote *kn, long hint)
{
struct lms_softc *sc = kn->kn_hook;
kn->kn_data = sc->sc_q.c_cc;
return (kn->kn_data > 0);
}
static const struct filterops lmsread_filtops =
{ 1, NULL, filt_lmsrdetach, filt_lmsread };
int
lmskqfilter(dev_t dev, struct knote *kn)
{
struct lms_softc *sc = lms_cd.cd_devs[LMSUNIT(dev)];
struct klist *klist;
int s;
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &sc->sc_rsel.si_klist;
kn->kn_fop = &lmsread_filtops;
break;
default:
return (1);
}
kn->kn_hook = sc;
s = spltty();
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
splx(s);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mms.c,v 1.9 2002/10/02 05:05:29 thorpej Exp $ */
/* $NetBSD: mms.c,v 1.10 2002/10/23 09:10:56 jdolecek Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles M. Hannum.
@ -81,10 +81,11 @@ dev_type_close(mmsclose);
dev_type_read(mmsread);
dev_type_ioctl(mmsioctl);
dev_type_poll(mmspoll);
dev_type_kqfilter(mmskqfilter);
const struct cdevsw mms_cdevsw = {
mmsopen, mmsclose, mmsread, nowrite, mmsioctl,
nostop, notty, mmspoll, nommap,
nostop, notty, mmspoll, nommap, mmskqfilter,
};
#define MMSUNIT(dev) (minor(dev))
@ -341,7 +342,7 @@ mmsintr(arg)
sc->sc_state &= ~MMS_ASLP;
wakeup((caddr_t)sc);
}
selwakeup(&sc->sc_rsel);
selnotify(&sc->sc_rsel, 0);
}
return -1;
@ -366,3 +367,52 @@ mmspoll(dev, events, p)
splx(s);
return (revents);
}
static void
filt_mmsrdetach(struct knote *kn)
{
struct mms_softc *sc = kn->kn_hook;
int s;
s = spltty();
SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
splx(s);
}
static int
filt_mmsread(struct knote *kn, long hint)
{
struct mms_softc *sc = kn->kn_hook;
kn->kn_data = sc->sc_q.c_cc;
return (kn->kn_data > 0);
}
static const struct filterops mmsread_filtops =
{ 1, NULL, filt_mmsrdetach, filt_mmsread };
int
mmskqfilter(dev_t dev, struct knote *kn)
{
struct mms_softc *sc = mms_cd.cd_devs[LMSUNIT(dev)];
struct klist *klist;
int s;
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &sc->sc_rsel.si_klist;
kn->kn_fop = &mmsread_filtops;
break;
default:
return (1);
}
kn->kn_hook = sc;
s = spltty();
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
splx(s);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pccons.c,v 1.25 2002/10/02 05:05:29 thorpej Exp $ */
/* $NetBSD: pccons.c,v 1.26 2002/10/23 09:10:57 jdolecek Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -193,7 +193,7 @@ dev_type_mmap(pcmmap);
const struct cdevsw pc_cdevsw = {
pcopen, pcclose, pcread, pcwrite, pcioctl,
pcstop, pctty, pcpoll, pcmmap, D_TTY
pcstop, pctty, pcpoll, pcmmap, ttykqfilter, D_TTY
};
#define COL 80

View File

@ -1,4 +1,4 @@
/* $NetBSD: spkr.c,v 1.11 2002/10/02 05:05:29 thorpej Exp $ */
/* $NetBSD: spkr.c,v 1.12 2002/10/23 09:10:57 jdolecek Exp $ */
/*
* spkr.c -- device driver for console speaker on 80386
@ -52,7 +52,7 @@ dev_type_ioctl(spkrioctl);
const struct cdevsw spkr_cdevsw = {
spkropen, spkrclose, noread, spkrwrite, spkrioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
/**************** MACHINE DEPENDENT PART STARTS HERE *************************

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.4 2002/10/05 16:25:34 chs Exp $ */
/* $NetBSD: mem.c,v 1.5 2002/10/23 09:10:58 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -66,7 +66,7 @@ dev_type_mmap(mmmmap);
const struct cdevsw mem_cdevsw = {
nullopen, nullclose, mmrw, mmrw, mmioctl,
nostop, notty, nopoll, mmmmap,
nostop, notty, nopoll, mmmmap, nokqfilter,
};
/*ARGSUSED*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: gdrom.c,v 1.13 2002/10/02 05:11:19 thorpej Exp $ */
/* $NetBSD: gdrom.c,v 1.14 2002/10/23 09:10:59 jdolecek Exp $ */
/*-
* Copyright (c) 2001 Marcus Comstedt
@ -66,7 +66,7 @@ const struct bdevsw gdrom_bdevsw = {
const struct cdevsw gdrom_cdevsw = {
gdromopen, gdromclose, gdromread, gdromwrite, gdromioctl,
nostop, notty, nopoll, nommap, D_DISK
nostop, notty, nopoll, nommap, nokqfilter, D_DISK
};
struct gdrom_softc {

View File

@ -1,4 +1,4 @@
/* $NetBSD: maple.c,v 1.19 2002/10/02 15:45:16 thorpej Exp $ */
/* $NetBSD: maple.c,v 1.20 2002/10/23 09:11:00 jdolecek Exp $ */
/*-
* Copyright (c) 2001 Marcus Comstedt
@ -103,7 +103,7 @@ dev_type_ioctl(mapleioctl);
const struct cdevsw maple_cdevsw = {
mapleopen, mapleclose, noread, nowrite, mapleioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: plcom.c,v 1.4 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: plcom.c,v 1.5 2002/10/23 09:11:01 jdolecek Exp $ */
/*-
* Copyright (c) 2001 ARM Ltd
@ -209,7 +209,7 @@ extern struct cfdriver plcom_cd;
const struct cdevsw plcom_cdevsw = {
plcomopen, plcomclose, plcomread, plcomwrite, plcomioctl,
plcomstop, plcomtty, plcompoll, nommap, D_TTY
plcomstop, plcomtty, plcompoll, nommap, ttykqfilter, D_TTY
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ac.c,v 1.17 2002/10/02 05:15:48 thorpej Exp $ */
/* $NetBSD: ac.c,v 1.18 2002/10/23 09:11:02 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -88,7 +88,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ac.c,v 1.17 2002/10/02 05:15:48 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ac.c,v 1.18 2002/10/23 09:11:02 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -99,6 +99,7 @@ __KERNEL_RCSID(0, "$NetBSD: ac.c,v 1.17 2002/10/02 05:15:48 thorpej Exp $");
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/event.h>
#include <hp300/dev/scsireg.h>
#include <hp300/dev/scsivar.h>
@ -119,7 +120,7 @@ dev_type_ioctl(acioctl);
const struct cdevsw ac_cdevsw = {
acopen, acclose, noread, nowrite, acioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
void acstart __P((void *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: apci.c,v 1.20 2002/10/02 05:15:48 thorpej Exp $ */
/* $NetBSD: apci.c,v 1.21 2002/10/23 09:11:02 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997, 1999 The NetBSD Foundation, Inc.
@ -93,7 +93,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: apci.c,v 1.20 2002/10/02 05:15:48 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: apci.c,v 1.21 2002/10/23 09:11:02 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -156,7 +156,7 @@ dev_type_poll(apcipoll);
const struct cdevsw apci_cdevsw = {
apciopen, apciclose, apciread, apciwrite, apciioctl,
apcistop, apcitty, apcipoll, nommap, D_TTY
apcistop, apcitty, apcipoll, nommap, ttykqfilter, D_TTY
};
int apciintr __P((void *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ct.c,v 1.32 2002/10/02 05:15:48 thorpej Exp $ */
/* $NetBSD: ct.c,v 1.33 2002/10/23 09:11:02 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -86,7 +86,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.32 2002/10/02 05:15:48 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.33 2002/10/23 09:11:02 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -168,7 +168,7 @@ const struct bdevsw ct_bdevsw = {
const struct cdevsw ct_cdevsw = {
ctopen, ctclose, ctread, ctwrite, ctioctl,
nostop, notty, nopoll, nommap, D_TAPE
nostop, notty, nopoll, nommap, nokqfilter, D_TAPE
};
int ctident __P((struct device *, struct ct_softc *,

View File

@ -1,4 +1,4 @@
/* $NetBSD: dca.c,v 1.52 2002/10/02 05:15:48 thorpej Exp $ */
/* $NetBSD: dca.c,v 1.53 2002/10/23 09:11:03 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -84,7 +84,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dca.c,v 1.52 2002/10/02 05:15:48 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: dca.c,v 1.53 2002/10/23 09:11:03 jdolecek Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -149,7 +149,7 @@ dev_type_poll(dcapoll);
const struct cdevsw dca_cdevsw = {
dcaopen, dcaclose, dcaread, dcawrite, dcaioctl,
dcastop, dcatty, dcapoll, nommap, D_TTY
dcastop, dcatty, dcapoll, nommap, ttykqfilter, D_TTY
};
int dcaintr __P((void *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: dcm.c,v 1.55 2002/10/20 06:26:39 gmcgarry Exp $ */
/* $NetBSD: dcm.c,v 1.56 2002/10/23 09:11:03 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -89,7 +89,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dcm.c,v 1.55 2002/10/20 06:26:39 gmcgarry Exp $");
__KERNEL_RCSID(0, "$NetBSD: dcm.c,v 1.56 2002/10/23 09:11:03 jdolecek Exp $");
#include "opt_kgdb.h"
@ -329,7 +329,7 @@ dev_type_poll(dcmpoll);
const struct cdevsw dcm_cdevsw = {
dcmopen, dcmclose, dcmread, dcmwrite, dcmioctl,
dcmstop, dcmtty, dcmpoll, nommap, D_TTY
dcmstop, dcmtty, dcmpoll, nommap, ttykqfilter, D_TTY
};
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf.c,v 1.47 2002/10/10 22:33:16 jdolecek Exp $ */
/* $NetBSD: grf.c,v 1.48 2002/10/23 09:11:05 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.47 2002/10/10 22:33:16 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.48 2002/10/23 09:11:05 jdolecek Exp $");
#include "opt_compat_hpux.h"
@ -104,7 +104,7 @@ dev_type_mmap(grfmmap);
const struct cdevsw grf_cdevsw = {
grfopen, grfclose, nullread, nullwrite, grfioctl,
nostop, notty, nopoll, grfmmap,
nostop, notty, nopoll, grfmmap, nokqfilter,
};
int grfprint __P((void *, const char *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: hil.c,v 1.51 2002/10/02 05:15:51 thorpej Exp $ */
/* $NetBSD: hil.c,v 1.52 2002/10/23 09:11:05 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hil.c,v 1.51 2002/10/02 05:15:51 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: hil.c,v 1.52 2002/10/23 09:11:05 jdolecek Exp $");
#include "opt_compat_hpux.h"
#include "rnd.h"
@ -111,10 +111,11 @@ dev_type_close(hilclose);
dev_type_read(hilread);
dev_type_ioctl(hilioctl);
dev_type_poll(hilpoll);
dev_type_kqfilter(hilkqfilter);
const struct cdevsw hil_cdevsw = {
hilopen, hilclose, hilread, nullwrite, hilioctl,
nostop, notty, hilpoll, nommap,
nostop, notty, hilpoll, nommap, hilkqfilter,
};
void hilattach_deferred __P((struct device *));
@ -837,6 +838,109 @@ hilpoll(dev, events, p)
return (revents);
}
static void
filt_hilrdetach(struct knote *kn)
{
dev_t dev = (intptr_t) kn->kn_hook;
struct hil_softc *hilp = hil_cd.cd_devs[HILLOOP(dev)];
struct hilloopdev *dptr = &hilp->hl_device[HILUNIT(dev)];
int s;
s = splhil();
SLIST_REMOVE(&dptr->hd_selr.si_klist, kn, knote, kn_selnext);
splx(s);
}
static int
filt_hilread(struct knote *kn, long hint)
{
dev_t dev = (intptr_t) kn->kn_hook;
int device = HILUNIT(dev);
struct hil_softc *hilp = hil_cd.cd_devs[HILLOOP(dev)];
struct hilloopdev *dptr = &hilp->hl_device[device];
struct hiliqueue *qp;
int mask;
if (dptr->hd_flags & HIL_READIN) {
kn->kn_data = dptr->hd_queue.c_cc;
return (kn->kn_data > 0);
}
/*
* Make sure device is alive and real (or the loop device).
* Note that we do not do this for the read interface.
* This is primarily to be consistant with HP-UX.
*/
if (device && (dptr->hd_flags & (HIL_ALIVE|HIL_PSEUDO)) != HIL_ALIVE) {
kn->kn_data = 0; /* XXXLUKEM (thorpej): what to put here? */
return (1);
}
/*
* Select on loop device is special.
* Check to see if there are any data for any loop device
* provided it is associated with a queue belonging to this user.
*/
if (device == 0)
mask = -1;
else
mask = hildevmask(device);
/*
* Must check everybody with interrupts blocked to prevent races.
* (Interrupts are already blocked.)
*/
for (qp = hilp->hl_queue; qp < &hilp->hl_queue[NHILQ]; qp++) {
/* XXXLUKEM (thorpej): PROCESS CHECK! */
if (/*qp->hq_procp == p &&*/ (mask & qp->hq_devmask) &&
qp->hq_eventqueue->hil_evqueue.head !=
qp->hq_eventqueue->hil_evqueue.tail) {
/* XXXLUKEM (thorpej): what to put here? */
kn->kn_data = 0;
return (1);
}
}
return (0);
}
static const struct filterops hilread_filtops =
{ 1, NULL, filt_hilrdetach, filt_hilread };
static const struct filterops hil_seltrue_filtops =
{ 1, NULL, filt_hilrdetach, filt_seltrue };
int
hilkqfilter(dev_t dev, struct knote *kn)
{
struct hil_softc *hilp = hil_cd.cd_devs[HILLOOP(dev)];
struct hilloopdev *dptr = &hilp->hl_device[HILUNIT(dev)];
struct klist *klist;
int s;
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &dptr->hd_selr.si_klist;
kn->kn_fop = &hilread_filtops;
break;
case EVFILT_WRITE:
klist = &dptr->hd_selr.si_klist;
kn->kn_fop = &hil_seltrue_filtops;
break;
default:
return (1);
}
kn->kn_hook = (void *)(intptr_t) dev; /* XXX yuck */
s = splhil();
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
splx(s);
return (0);
}
/*ARGSUSED*/
int
hilint(v)
@ -1027,9 +1131,9 @@ hilevent(hilp)
/*
* Wake up anyone selecting on this device or the loop itself
*/
selwakeup(&dptr->hd_selr);
selnotify(&dptr->hd_selr, 0);
dptr = &hilp->hl_device[HILLOOPDEV];
selwakeup(&dptr->hd_selr);
selnotify(&dptr->hd_selr, 0);
}
#undef HQFULL
@ -1072,7 +1176,7 @@ hpuxhilevent(hilp, dptr)
dptr->hd_flags &= ~HIL_ASLEEP;
wakeup((caddr_t)dptr);
}
selwakeup(&dptr->hd_selr);
selnotify(&dptr->hd_selr, 0);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.56 2002/10/02 05:15:53 thorpej Exp $ */
/* $NetBSD: ite.c,v 1.57 2002/10/23 09:11:06 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -85,7 +85,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.56 2002/10/02 05:15:53 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.57 2002/10/23 09:11:06 jdolecek Exp $");
#include "hil.h"
@ -142,7 +142,7 @@ dev_type_poll(itepoll);
const struct cdevsw ite_cdevsw = {
iteopen, iteclose, iteread, itewrite, iteioctl,
nostop, itetty, itepoll, nommap, D_TTY
nostop, itetty, itepoll, nommap, ttykqfilter, D_TTY
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: mt.c,v 1.20 2002/10/02 05:15:53 thorpej Exp $ */
/* $NetBSD: mt.c,v 1.21 2002/10/23 09:11:07 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.20 2002/10/02 05:15:53 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.21 2002/10/23 09:11:07 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -154,7 +154,7 @@ const struct bdevsw mt_bdevsw = {
const struct cdevsw mt_cdevsw = {
mtopen, mtclose, mtread, mtwrite, mtioctl,
nostop, notty, nopoll, nommap, D_TAPE
nostop, notty, nopoll, nommap, nokqfilter, D_TAPE
};
int mtident __P((struct mt_softc *, struct hpibbus_attach_args *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ppi.c,v 1.23 2002/10/02 05:15:54 thorpej Exp $ */
/* $NetBSD: ppi.c,v 1.24 2002/10/23 09:11:07 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ppi.c,v 1.23 2002/10/02 05:15:54 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ppi.c,v 1.24 2002/10/23 09:11:07 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -129,7 +129,7 @@ dev_type_ioctl(ppiioctl);
const struct cdevsw ppi_cdevsw = {
ppiopen, ppiclose, ppiread, ppiwrite, ppiioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
void ppistart __P((void *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: rd.c,v 1.53 2002/10/02 05:15:54 thorpej Exp $ */
/* $NetBSD: rd.c,v 1.54 2002/10/23 09:11:08 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.53 2002/10/02 05:15:54 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.54 2002/10/23 09:11:08 jdolecek Exp $");
#include "opt_useleds.h"
#include "rnd.h"
@ -300,7 +300,7 @@ const struct bdevsw rd_bdevsw = {
const struct cdevsw rd_cdevsw = {
rdopen, rdclose, rdread, rdwrite, rdioctl,
nostop, notty, nopoll, nommap, D_DISK
nostop, notty, nopoll, nommap, nokqfilter, D_DISK
};
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd.c,v 1.55 2002/10/02 05:15:55 thorpej Exp $ */
/* $NetBSD: sd.c,v 1.56 2002/10/23 09:11:09 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.55 2002/10/02 05:15:55 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.56 2002/10/23 09:11:09 jdolecek Exp $");
#include "rnd.h"
#include "opt_useleds.h"
@ -132,7 +132,7 @@ const struct bdevsw sd_bdevsw = {
const struct cdevsw sd_cdevsw = {
sdopen, sdclose, sdread, sdwrite, sdioctl,
nostop, notty, nopoll, nommap, D_DISK
nostop, notty, nopoll, nommap, nokqfilter, D_DISK
};
#ifdef DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: st.c,v 1.35 2002/10/02 05:15:55 thorpej Exp $ */
/* $NetBSD: st.c,v 1.36 2002/10/23 09:11:10 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -111,7 +111,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.35 2002/10/02 05:15:55 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.36 2002/10/23 09:11:10 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -229,7 +229,7 @@ const struct bdevsw st_bdevsw = {
const struct cdevsw st_cdevsw = {
stopen, stclose, stread, stwrite, stioctl,
nostop, notty, nopoll, nommap, D_TAPE
nostop, notty, nopoll, nommap, nokqfilter, D_TAPE
};
static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.37 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: mem.c,v 1.38 2002/10/23 09:11:11 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.37 2002/09/06 13:18:43 gehenna Exp $");
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.38 2002/10/23 09:11:11 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -69,7 +69,7 @@ dev_type_mmap(mmmmap);
const struct cdevsw mem_cdevsw = {
nullopen, nullclose, mmrw, mmrw, mmioctl,
nostop, notty, nopoll, mmmmap,
nostop, notty, nopoll, mmmmap, nokqfilter,
};
/*ARGSUSED*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: pdc.c,v 1.7 2002/10/02 05:17:48 thorpej Exp $ */
/* $NetBSD: pdc.c,v 1.8 2002/10/23 09:11:14 jdolecek Exp $ */
/* $OpenBSD: pdc.c,v 1.14 2001/04/29 21:05:43 mickey Exp $ */
@ -82,7 +82,7 @@ dev_type_poll(pdcpoll);
const struct cdevsw pdc_cdevsw = {
pdcopen, pdcclose, pdcread, pdcwrite, pdcioctl,
pdcstop, pdctty, pdcpoll, nommap, D_TTY
pdcstop, pdctty, pdcpoll, nommap, ttykqfilter, D_TTY
};
void pdcstart __P((struct tty *tp));

View File

@ -1,4 +1,4 @@
/* $NetBSD: apm.c,v 1.4 2002/10/07 21:32:10 jdolecek Exp $ */
/* $NetBSD: apm.c,v 1.5 2002/10/23 09:11:15 jdolecek Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -39,7 +39,7 @@
#include "apm.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.4 2002/10/07 21:32:10 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.5 2002/10/23 09:11:15 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -73,7 +73,7 @@ CFATTACH_DECL(apm, sizeof(struct apm_softc),
const struct cdevsw apm_cdevsw = {
apmopen, apmclose, noread, nowrite, apmioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: apmdev.c,v 1.12 2002/10/14 13:34:09 takemura Exp $ */
/* $NetBSD: apmdev.c,v 1.13 2002/10/23 09:11:17 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -154,10 +154,11 @@ dev_type_open(apmdevopen);
dev_type_close(apmdevclose);
dev_type_ioctl(apmdevioctl);
dev_type_poll(apmdevpoll);
dev_type_kqfilter(apmdevkqfilter);
const struct cdevsw apmdev_cdevsw = {
apmdevopen, apmdevclose, noread, nowrite, apmdevioctl,
nostop, notty, apmdevpoll, nommap,
nostop, notty, apmdevpoll, nommap, apmdevkqfilter,
};
/* configurable variables */
@ -410,7 +411,7 @@ apm_record_event(struct apm_softc *sc, u_int event_type)
sc->event_ptr %= APM_NEVENTS;
evp->type = event_type;
evp->index = ++apm_evindex;
selwakeup(&sc->sc_rsel);
selnotify(&sc->sc_rsel, 0);
return (sc->sc_flags & SCFLAG_OWRITE) ? 0 : 1; /* user may handle */
}
@ -933,3 +934,50 @@ apmdevpoll(dev_t dev, int events, struct proc *p)
return (revents);
}
static void
filt_apmrdetach(struct knote *kn)
{
struct apm_softc *sc = kn->kn_hook;
APM_LOCK(sc);
SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
APM_UNLOCK(sc);
}
static int
filt_apmread(struct knote *kn, long hint)
{
struct apm_softc *sc = kn->kn_hook;
kn->kn_data = sc->event_count;
return (kn->kn_data > 0);
}
static const struct filterops apmread_filtops =
{ 1, NULL, filt_apmrdetach, filt_apmread };
int
apmdevkqfilter(dev_t dev, struct knote *kn)
{
struct apm_softc *sc = apmdev_cd.cd_devs[APMUNIT(dev)];
struct klist *klist;
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &sc->sc_rsel.si_klist;
kn->kn_fop = &apmread_filtops;
break;
default:
return (1);
}
kn->kn_hook = sc;
APM_LOCK(sc);
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
APM_UNLOCK(sc);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ucbsnd.c,v 1.13 2002/10/10 22:36:09 jdolecek Exp $ */
/* $NetBSD: ucbsnd.c,v 1.14 2002/10/23 09:11:16 jdolecek Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -182,7 +182,7 @@ dev_type_write(ucbsndwrite);
const struct cdevsw ucbsnd_cdevsw = {
ucbsndopen, ucbsndclose, ucbsndread, ucbsndwrite, nullioctl,
nostop, notty, nopoll, nullmmap,
nostop, notty, nopoll, nullmmap, nokqfilter,
};
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: txcom.c,v 1.19 2002/10/02 05:26:51 thorpej Exp $ */
/* $NetBSD: txcom.c,v 1.20 2002/10/23 09:11:18 jdolecek Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -185,7 +185,7 @@ dev_type_poll(txcompoll);
const struct cdevsw txcom_cdevsw = {
txcomopen, txcomclose, txcomread, txcomwrite, txcomioctl,
txcomstop, txcomtty, txcompoll, nommap, D_TTY
txcomstop, txcomtty, txcompoll, nommap, ttykqfilter, D_TTY
};
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: apm.c,v 1.73 2002/10/02 05:47:08 thorpej Exp $ */
/* $NetBSD: apm.c,v 1.74 2002/10/23 09:11:19 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.73 2002/10/02 05:47:08 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.74 2002/10/23 09:11:19 jdolecek Exp $");
#include "apm.h"
#if NAPM > 1
@ -184,10 +184,11 @@ dev_type_open(apmopen);
dev_type_close(apmclose);
dev_type_ioctl(apmioctl);
dev_type_poll(apmpoll);
dev_type_kqfilter(apmkqfilter);
const struct cdevsw apm_cdevsw = {
apmopen, apmclose, noread, nowrite, apmioctl,
nostop, notty, apmpoll, nommap,
nostop, notty, apmpoll, nommap, apmkqfilter,
};
/* configurable variables */
@ -613,7 +614,7 @@ apm_record_event(sc, event_type)
sc->event_ptr %= APM_NEVENTS;
evp->type = event_type;
evp->index = ++apm_evindex;
selwakeup(&sc->sc_rsel);
selnotify(&sc->sc_rsel, 0);
return (sc->sc_flags & SCFLAG_OWRITE) ? 0 : 1; /* user may handle */
}
@ -1816,3 +1817,50 @@ apmpoll(dev, events, p)
return (revents);
}
static void
filt_apmrdetach(struct knote *kn)
{
struct apm_softc *sc = kn->kn_hook;
APM_LOCK(sc);
SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
APM_UNLOCK(sc);
}
static int
filt_apmread(struct knote *kn, long hint)
{
struct apm_softc *sc = kn->kn_hook;
kn->kn_data = sc->event_count;
return (kn->kn_data > 0);
}
static const struct filterops apmread_filtops =
{ 1, NULL, filt_apmrdetach, filt_apmread };
int
apmkqfilter(dev_t dev, struct knote *kn)
{
struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)];
struct klist *klist;
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &sc->sc_rsel.si_klist;
kn->kn_fop = &apmread_filtops;
break;
default:
return (1);
}
kn->kn_hook = sc;
APM_LOCK(sc);
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
APM_UNLOCK(sc);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.53 2002/10/01 12:56:57 fvdl Exp $ */
/* $NetBSD: mem.c,v 1.54 2002/10/23 09:11:21 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.53 2002/10/01 12:56:57 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.54 2002/10/23 09:11:21 jdolecek Exp $");
#include "opt_compat_netbsd.h"
@ -74,7 +74,7 @@ dev_type_mmap(mmmmap);
const struct cdevsw mem_cdevsw = {
mmopen, nullclose, mmrw, mmrw, mmioctl,
nostop, notty, nopoll, mmmmap,
nostop, notty, nopoll, mmmmap, nokqfilter,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: olms.c,v 1.8 2002/10/02 05:47:13 thorpej Exp $ */
/* $NetBSD: olms.c,v 1.9 2002/10/23 09:11:21 jdolecek Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles M. Hannum.
@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: olms.c,v 1.8 2002/10/02 05:47:13 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: olms.c,v 1.9 2002/10/23 09:11:21 jdolecek Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -88,10 +88,11 @@ dev_type_close(lmsclose);
dev_type_read(lmsread);
dev_type_ioctl(lmsioctl);
dev_type_poll(lmspoll);
dev_type_kqfilter(lmskqfilter);
const struct cdevsw olms_cdevsw = {
lmsopen, lmsclose, lmsread, nowrite, lmsioctl,
nostop, notty, lmspoll, nommap,
nostop, notty, lmspoll, nommap, lmskqfilter,
};
#define LMSUNIT(dev) (minor(dev))
@ -386,7 +387,7 @@ olmsintr(arg)
sc->sc_state &= ~LMS_ASLP;
wakeup((caddr_t)sc);
}
selwakeup(&sc->sc_rsel);
selnotify(&sc->sc_rsel, 0);
}
return -1;
@ -412,3 +413,52 @@ lmspoll(dev, events, p)
splx(s);
return (revents);
}
static void
filt_lmsrdetach(struct knote *kn)
{
struct olms_softc *sc = kn->kn_hook;
int s;
s = spltty();
SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
splx(s);
}
static int
filt_lmsread(struct knote *kn, long hint)
{
struct olms_softc *sc = kn->kn_hook;
kn->kn_data = sc->sc_q.c_cc;
return (kn->kn_data > 0);
}
static const struct filterops lmsread_filtops =
{ 1, NULL, filt_lmsrdetach, filt_lmsread };
int
lmskqfilter(dev_t dev, struct knote *kn)
{
struct olms_softc *sc = olms_cd.cd_devs[LMSUNIT(dev)];
struct klist *klist;
int s;
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &sc->sc_rsel.si_klist;
kn->kn_fop = &lmsread_filtops;
break;
default:
return (1);
}
kn->kn_hook = sc;
s = spltty();
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
splx(s);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: omms.c,v 1.8 2002/10/02 05:47:14 thorpej Exp $ */
/* $NetBSD: omms.c,v 1.9 2002/10/23 09:11:22 jdolecek Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles M. Hannum.
@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: omms.c,v 1.8 2002/10/02 05:47:14 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: omms.c,v 1.9 2002/10/23 09:11:22 jdolecek Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -86,10 +86,11 @@ dev_type_close(mmsclose);
dev_type_read(mmsread);
dev_type_ioctl(mmsioctl);
dev_type_poll(mmspoll);
dev_type_kqfilter(mmskqfilter);
const struct cdevsw omms_cdevsw = {
mmsopen, mmsclose, mmsread, nowrite, mmsioctl,
nostop, notty, mmspoll, nommap,
nostop, notty, mmspoll, nommap, mmskqfilter,
};
@ -382,7 +383,7 @@ ommsintr(arg)
sc->sc_state &= ~MMS_ASLP;
wakeup((caddr_t)sc);
}
selwakeup(&sc->sc_rsel);
selnotify(&sc->sc_rsel, 0);
}
return -1;
@ -408,3 +409,52 @@ mmspoll(dev, events, p)
splx(s);
return (revents);
}
static void
filt_mmsrdetach(struct knote *kn)
{
struct omms_softc *sc = kn->kn_hook;
int s;
s = spltty();
SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
splx(s);
}
static int
filt_mmsread(struct knote *kn, long hint)
{
struct omms_softc *sc = kn->kn_hook;
kn->kn_data = sc->sc_q.c_cc;
return (kn->kn_data > 0);
}
static const struct filterops mmsread_filtops =
{ 1, NULL, filt_mmsrdetach, filt_mmsread };
int
mmskqfilter(dev_t dev, struct knote *kn)
{
struct omms_softc *sc = omms_cd.cd_devs[MMSUNIT(dev)];
struct klist *klist;
int s;
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &sc->sc_rsel.si_klist;
kn->kn_fop = &mmsread_filtops;
break;
default:
return (1);
}
kn->kn_hook = sc;
s = spltty();
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
splx(s);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pccons.c,v 1.158 2002/10/02 15:52:22 thorpej Exp $ */
/* $NetBSD: pccons.c,v 1.159 2002/10/23 09:11:23 jdolecek Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pccons.c,v 1.158 2002/10/02 15:52:22 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: pccons.c,v 1.159 2002/10/23 09:11:23 jdolecek Exp $");
#include "opt_ddb.h"
#include "opt_xserver.h"
@ -242,7 +242,7 @@ dev_type_mmap(pcmmap);
const struct cdevsw pc_cdevsw = {
pcopen, pcclose, pcread, pcwrite, pcioctl,
pcstop, pctty, pcpoll, pcmmap, D_TTY
pcstop, pctty, pcpoll, pcmmap, ttykqfilter, D_TTY
};
#define COL 80

View File

@ -1,4 +1,4 @@
/* $NetBSD: siotty.c,v 1.11 2002/10/02 05:31:46 thorpej Exp $ */
/* $NetBSD: siotty.c,v 1.12 2002/10/23 09:11:25 jdolecek Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.11 2002/10/02 05:31:46 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.12 2002/10/23 09:11:25 jdolecek Exp $");
#include "opt_ddb.h"
@ -110,7 +110,7 @@ dev_type_poll(siopoll);
const struct cdevsw siotty_cdevsw = {
sioopen, sioclose, sioread, siowrite, sioioctl,
siostop, siotty, siopoll, nommap, D_TTY
siostop, siotty, siopoll, nommap, ttykqfilter, D_TTY
};
static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.7 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: mem.c,v 1.8 2002/10/23 09:11:26 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -42,7 +42,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.7 2002/09/06 13:18:43 gehenna Exp $");
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.8 2002/10/23 09:11:26 jdolecek Exp $");
/*
* Memory special file
@ -69,7 +69,7 @@ dev_type_mmap(mmmmap);
const struct cdevsw mem_cdevsw = {
nullopen, nullclose, mmrw, mmrw, mmioctl,
nostop, notty, nopoll, mmmmap,
nostop, notty, nopoll, mmmmap, nokqfilter,
};
/*ARGSUSED*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: aed.c,v 1.14 2002/10/02 05:36:37 thorpej Exp $ */
/* $NetBSD: aed.c,v 1.15 2002/10/23 09:11:28 jdolecek Exp $ */
/*
* Copyright (C) 1994 Bradley A. Grantham
@ -79,10 +79,11 @@ dev_type_close(aedclose);
dev_type_read(aedread);
dev_type_ioctl(aedioctl);
dev_type_poll(aedpoll);
dev_type_kqfilter(aedkqfilter);
const struct cdevsw aed_cdevsw = {
aedopen, aedclose, aedread, nullwrite, aedioctl,
nostop, notty, aedpoll, nommap,
nostop, notty, aedpoll, nommap, aedkqfilter,
};
static int
@ -408,7 +409,7 @@ aed_enqevent(event)
AED_MAX_EVENTS] = *event;
aed_sc->sc_evq_len++;
selwakeup(&aed_sc->sc_selinfo);
selnotify(&aed_sc->sc_selinfo, 0);
if (aed_sc->sc_ioproc)
psignal(aed_sc->sc_ioproc, SIGIO);
@ -600,3 +601,57 @@ aedpoll(dev, events, p)
return (revents);
}
static void
filt_aedrdetach(struct knote *kn)
{
int s;
s = spladb();
SLIST_REMOVE(&aed_sc->sc_selinfo.si_klist, kn, knote, kn_selnext);
splx(s);
}
static int
filt_aedread(struct knote *kn, long hint)
{
kn->kn_data = aed_sc->sc_evq_len * sizeof(adb_event_t);
return (kn->kn_data > 0);
}
static const struct filterops aedread_filtops =
{ 1, NULL, filt_aedrdetach, filt_aedread };
static const struct filterops aed_seltrue_filtops =
{ 1, NULL, filt_aedrdetach, filt_seltrue };
int
aedkqfilter(dev_t dev, struct knote *kn)
{
struct klist *klist;
int s;
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &aed_sc->sc_selinfo.si_klist;
kn->kn_fop = &aedread_filtops;
break;
case EVFILT_WRITE:
klist = &aed_sc->sc_selinfo.si_klist;
kn->kn_fop = &aed_seltrue_filtops;
break;
default:
return (1);
}
kn->kn_hook = NULL;
s = spladb();
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
splx(s);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf_compat.c,v 1.9 2002/10/10 22:33:16 jdolecek Exp $ */
/* $NetBSD: grf_compat.c,v 1.10 2002/10/23 09:11:28 jdolecek Exp $ */
/*
* Copyright (C) 1999 Scott Reynolds
@ -64,7 +64,7 @@ dev_type_mmap(grfmmap);
const struct cdevsw grf_cdevsw = {
grfopen, grfclose, noread, nowrite, grfioctl,
nostop, notty, nopoll, grfmmap,
nostop, notty, nopoll, grfmmap, nokqfilter,
};
void grf_scinit __P((struct grf_softc *, const char *, int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite_compat.c,v 1.5 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: ite_compat.c,v 1.6 2002/10/23 09:11:28 jdolecek Exp $ */
/*
* Copyright (C) 2000 Scott Reynolds
@ -57,10 +57,11 @@ dev_type_write(itewrite);
dev_type_ioctl(iteioctl);
dev_type_tty(itetty);
dev_type_poll(itepoll);
dev_type_kqfilter(itekqfilter);
const struct cdevsw ite_cdevsw = {
iteopen, iteclose, iteread, itewrite, iteioctl,
nostop, itetty, itepoll, nommap, D_TTY
nostop, itetty, itepoll, nommap, itekqfilter, D_TTY
};
#if NWSDISPLAY > 0
@ -209,3 +210,12 @@ itepoll(dev, events, p)
return ite_initted ?
(*wsdisplay_cdevsw.d_poll)(cn_tab->cn_dev, events, p) : (ENXIO);
}
int
itekqfilter(dev, kn)
dev_t dev;
struct knote *kn;
{
return ite_initted ?
(*wsdisplay_cdevsw.d_kqfilter)(cn_tab->cn_dev, kn) : (ENXIO);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.31 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: mem.c,v 1.32 2002/10/23 09:11:29 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -65,7 +65,7 @@ dev_type_mmap(mmmmap);
const struct cdevsw mem_cdevsw = {
nullopen, nullclose, mmrw, mmrw, mmioctl,
nostop, notty, nopoll, mmmmap,
nostop, notty, nopoll, mmmmap, nokqfilter,
};
/*ARGSUSED*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: asc.c,v 1.43 2002/10/10 22:33:16 jdolecek Exp $ */
/* $NetBSD: asc.c,v 1.44 2002/10/23 09:11:30 jdolecek Exp $ */
/*
* Copyright (C) 1997 Scott Reynolds
@ -120,7 +120,7 @@ dev_type_mmap(ascmmap);
const struct cdevsw asc_cdevsw = {
ascopen, ascclose, ascread, ascwrite, ascioctl,
nostop, notty, nopoll, ascmmap,
nostop, notty, nopoll, ascmmap, nokqfilter,
};
static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: iwm_fd.c,v 1.17 2002/10/02 20:35:28 jdolecek Exp $ */
/* $NetBSD: iwm_fd.c,v 1.18 2002/10/23 09:11:30 jdolecek Exp $ */
/*
* Copyright (c) 1997, 1998 Hauke Fath. All rights reserved.
@ -40,6 +40,7 @@
#include <sys/ioctl.h>
#include <sys/malloc.h>
#include <sys/device.h>
#include <sys/event.h>
#define FSTYPENAMES
#define DKTYPENAMES
@ -241,7 +242,7 @@ const struct bdevsw fd_bdevsw = {
const struct cdevsw fd_cdevsw = {
fdopen, fdclose, fdread, fdwrite, fdioctl,
nostop, notty, nopoll, nommap, D_DISK
nostop, notty, nopoll, nommap, nokqfilter, D_DISK
};
/* disk(9) framework device switch */

View File

@ -1,4 +1,4 @@
/* $NetBSD: aed.c,v 1.9 2002/10/02 05:30:38 thorpej Exp $ */
/* $NetBSD: aed.c,v 1.10 2002/10/23 09:11:32 jdolecek Exp $ */
/*
* Copyright (C) 1994 Bradley A. Grantham
@ -83,10 +83,11 @@ dev_type_close(aedclose);
dev_type_read(aedread);
dev_type_ioctl(aedioctl);
dev_type_poll(aedpoll);
dev_type_kqfilter(aedkqfilter);
const struct cdevsw aed_cdevsw = {
aedopen, aedclose, aedread, nullwrite, aedioctl,
nostop, notty, aedpoll, nommap,
nostop, notty, aedpoll, nommap, aedkqfilter,
};
static int
@ -409,7 +410,7 @@ aed_enqevent(event)
AED_MAX_EVENTS] = *event;
aed_sc->sc_evq_len++;
selwakeup(&aed_sc->sc_selinfo);
selnotify(&aed_sc->sc_selinfo, 0);
if (aed_sc->sc_ioproc)
psignal(aed_sc->sc_ioproc, SIGIO);
@ -601,3 +602,57 @@ aedpoll(dev, events, p)
return (revents);
}
static void
filt_aedrdetach(struct knote *kn)
{
int s;
s = spladb();
SLIST_REMOVE(&aed_sc->sc_selinfo.si_klist, kn, knote, kn_selnext);
splx(s);
}
static int
filt_aedread(struct knote *kn, long hint)
{
kn->kn_data = aed_sc->sc_evq_len * sizeof(adb_event_t);
return (kn->kn_data > 0);
}
static const struct filterops aedread_filtops =
{ 1, NULL, filt_aedrdetach, filt_aedread };
static const struct filterops aed_seltrue_filtops =
{ 1, NULL, filt_aedrdetach, filt_seltrue };
int
aedkqfilter(dev_t dev, struct knote *kn)
{
struct klist *klist;
int s;
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &aed_sc->sc_selinfo.si_klist;
kn->kn_fop = &aedread_filtops;
break;
case EVFILT_WRITE:
klist = &aed_sc->sc_selinfo.si_klist;
kn->kn_fop = &aed_seltrue_filtops;
break;
default:
return (1);
}
kn->kn_hook = NULL;
s = spladb();
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
splx(s);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: apm.c,v 1.4 2002/10/02 05:30:39 thorpej Exp $ */
/* $NetBSD: apm.c,v 1.5 2002/10/23 09:11:32 jdolecek Exp $ */
/* $OpenBSD: apm.c,v 1.5 2002/06/07 07:13:59 miod Exp $ */
/*-
@ -128,10 +128,11 @@ dev_type_open(apmopen);
dev_type_close(apmclose);
dev_type_ioctl(apmioctl);
dev_type_poll(apmpoll);
dev_type_kqfilter(apmkqfilter);
const struct cdevsw apm_cdevsw = {
apmopen, apmclose, noread, nowrite, apmioctl,
nostop, notty, apmpoll, nommap,
nostop, notty, apmpoll, nommap, apmkqfilter,
};
#endif
@ -142,15 +143,6 @@ int apm_evindex;
#define APMDEV_NORMAL 0
#define APMDEV_CTL 8
#ifdef __OpenBSD__
void filt_apmrdetach(struct knote *kn);
int filt_apmread(struct knote *kn, long hint);
int apmkqfilter(dev_t dev, struct knote *kn);
struct filterops apmread_filtops =
{ 1, NULL, filt_apmrdetach, filt_apmread};
#endif
/*
* Flags to control kernel display
* SCFLAG_NOPRINT: do not output APM power messages due to
@ -431,51 +423,50 @@ apmpoll(dev, events, p)
}
#endif
#ifdef __OpenBSD__
void
filt_apmrdetach(kn)
struct knote *kn;
static void
filt_apmrdetach(struct knote *kn)
{
struct apm_softc *sc = (struct apm_softc *)kn->kn_hook;
SLIST_REMOVE(&sc->sc_note, kn, knote, kn_selnext);
APM_LOCK(sc);
SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
APM_UNLOCK(sc);
}
int
filt_apmread(kn, hint)
struct knote *kn;
long hint;
static int
filt_apmread(struct knote *kn, long hint)
{
/* XXX weird kqueue_scan() semantics */
if (hint && !kn->kn_data)
kn->kn_data = (int)hint;
struct apm_softc *sc = kn->kn_hook;
return (1);
kn->kn_data = sc->event_count;
return (kn->kn_data > 0);
}
static struct filterops apmread_filtops =
{ 1, NULL, filt_apmrdetach, filt_apmread};
int
apmkqfilter(dev, kn)
dev_t dev;
struct knote *kn;
{
struct apm_softc *sc;
/* apm0 only */
if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 ||
!(sc = apm_cd.cd_devs[APMUNIT(dev)]))
return ENXIO;
struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)];
struct klist *klist;
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &sc->sc_rsel.si_klist;
kn->kn_fop = &apmread_filtops;
break;
default:
return (1);
}
kn->kn_hook = (caddr_t)sc;
SLIST_INSERT_HEAD(&sc->sc_note, kn, kn_selnext);
kn->kn_hook = sc;
APM_LOCK(sc);
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
APM_UNLOCK(sc);
return (0);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: nvram.c,v 1.7 2002/10/02 05:30:42 thorpej Exp $ */
/* $NetBSD: nvram.c,v 1.8 2002/10/23 09:11:33 jdolecek Exp $ */
/*-
* Copyright (C) 1998 Internet Research Institute, Inc.
@ -39,6 +39,7 @@
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/event.h>
#include <machine/autoconf.h>
#include <machine/pio.h>
@ -70,7 +71,7 @@ dev_type_mmap(nvrammmap);
const struct cdevsw nvram_cdevsw = {
nullopen, nullclose, nvramread, nvramwrite, noioctl,
nostop, notty, nopoll, nvrammmap,
nostop, notty, nopoll, nvrammmap, nokqfilter,
};
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofcons.c,v 1.11 2002/10/02 05:30:43 thorpej Exp $ */
/* $NetBSD: ofcons.c,v 1.12 2002/10/23 09:11:33 jdolecek Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -79,7 +79,7 @@ dev_type_poll(ofcpoll);
const struct cdevsw macofcons_cdevsw = {
ofcopen, ofcclose, ofcread, ofcwrite, ofcioctl,
nostop, ofctty, ofcpoll, nommap, D_TTY
nostop, ofctty, ofcpoll, nommap, ttykqfilter, D_TTY
};
/* For polled ADB mode */

View File

@ -1,4 +1,4 @@
/* $NetBSD: z8530tty.c,v 1.15 2002/10/02 05:30:44 thorpej Exp $ */
/* $NetBSD: z8530tty.c,v 1.16 2002/10/23 09:11:33 jdolecek Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999
@ -210,7 +210,7 @@ dev_type_poll(zspoll);
const struct cdevsw zstty_cdevsw = {
zsopen, zsclose, zsread, zswrite, zsioctl,
zsstop, zstty, zspoll, nommap, D_TTY
zsstop, zstty, zspoll, nommap, ttykqfilter, D_TTY
};
struct zsops zsops_tty;

View File

@ -1,6 +1,6 @@
#define AU1x00_UART /* XXX */
/* $NetBSD: aucom.c,v 1.2 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: aucom.c,v 1.3 2002/10/23 09:11:34 jdolecek Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -80,7 +80,7 @@
* XXX: hacked to work with almost 16550-alike Alchemy Au1X00 on-chip uarts
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: aucom.c,v 1.2 2002/09/06 13:18:43 gehenna Exp $");
__KERNEL_RCSID(0, "$NetBSD: aucom.c,v 1.3 2002/10/23 09:11:34 jdolecek Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@ -244,7 +244,7 @@ dev_type_poll(compoll);
const struct cdevsw com_cdevsw = {
comopen, comclose, comread, comwrite, comioctl,
comstop, comtty, compoll, nommap, D_TTY
comstop, comtty, compoll, nommap, ttykqfilter, D_TTY
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.25 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: mem.c,v 1.26 2002/10/23 09:11:36 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -64,13 +64,13 @@ dev_type_ioctl(mmioctl);
const struct cdevsw mem_cdevsw = {
nullopen, nullclose, mmrw, mmrw, mmioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
#if defined(pmax)
const struct cdevsw mem_ultrix_cdevsw = {
nullopen, nullclose, mmrw, mmrw, mmioctl,
nostop, notty, nopoll, nommap,
nostop, notty, nopoll, nommap, nokqfilter,
};
#endif /* defined(pmax) */

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbjcn.c,v 1.4 2002/10/02 15:52:25 thorpej Exp $ */
/* $NetBSD: sbjcn.c,v 1.5 2002/10/23 09:11:37 jdolecek Exp $ */
/*
* Copyright 2000, 2001
@ -184,7 +184,7 @@ dev_type_tty(sbjcntty);
const struct cdevsw sbjcn_cdevsw = {
sbjcnopen, sbjcnclose, sbjcnread, sbjcnwrite, sbjcnioctl,
sbjcnstop, sbjcntty, nopoll, nommap, D_TTY
sbjcnstop, sbjcntty, nopoll, nommap, ttykqfilter, D_TTY
};
#define integrate static inline

Some files were not shown because too many files have changed in this diff Show More