summaryrefslogtreecommitdiff
path: root/sys/miscfs/specfs
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-09-23 16:51:15 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-09-23 16:51:15 +0000
commit6bb276a1685d8546283d224a3d249c66cc329264 (patch)
tree5e1c80d6cad38a8a82f5832e1e315103e7029eb9 /sys/miscfs/specfs
parent96675671ec2520ade2f83b31563ab4da72bd443d (diff)
Replace select backends with poll backends. selscan() and pollscan()
now call the poll backend. With this change we implement greater poll(2) functionality instead of emulating it via the select backend. Adapted from NetBSD and including some changes from FreeBSD. Tested by many, deraadt@ OK
Diffstat (limited to 'sys/miscfs/specfs')
-rw-r--r--sys/miscfs/specfs/spec_vnops.c17
-rw-r--r--sys/miscfs/specfs/specdev.h4
2 files changed, 10 insertions, 11 deletions
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index f945ef378ca..c3e675b5905 100644
--- a/sys/miscfs/specfs/spec_vnops.c
+++ b/sys/miscfs/specfs/spec_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spec_vnops.c,v 1.26 2003/06/02 23:28:11 millert Exp $ */
+/* $OpenBSD: spec_vnops.c,v 1.27 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */
/*
@@ -47,6 +47,7 @@
#include <sys/file.h>
#include <sys/disklabel.h>
#include <sys/lockf.h>
+#include <sys/poll.h>
#include <miscfs/specfs/specdev.h>
@@ -78,7 +79,7 @@ struct vnodeopv_entry_desc spec_vnodeop_entries[] = {
{ &vop_write_desc, spec_write }, /* write */
{ &vop_lease_desc, spec_lease_check }, /* lease */
{ &vop_ioctl_desc, spec_ioctl }, /* ioctl */
- { &vop_select_desc, spec_select }, /* select */
+ { &vop_poll_desc, spec_poll }, /* poll */
{ &vop_kqfilter_desc, spec_kqfilter }, /* kqfilter */
{ &vop_revoke_desc, spec_revoke }, /* revoke */
{ &vop_fsync_desc, spec_fsync }, /* fsync */
@@ -450,14 +451,12 @@ spec_ioctl(v)
/* ARGSUSED */
int
-spec_select(v)
+spec_poll(v)
void *v;
{
- struct vop_select_args /* {
+ struct vop_poll_args /* {
struct vnode *a_vp;
- int a_which;
- int a_fflags;
- struct ucred *a_cred;
+ int a_events;
struct proc *a_p;
} */ *ap = v;
register dev_t dev;
@@ -465,11 +464,11 @@ spec_select(v)
switch (ap->a_vp->v_type) {
default:
- return (1); /* XXX */
+ return (seltrue(ap->a_vp->v_rdev, ap->a_events, ap->a_p));
case VCHR:
dev = ap->a_vp->v_rdev;
- return (*cdevsw[major(dev)].d_select)(dev, ap->a_which, ap->a_p);
+ return (*cdevsw[major(dev)].d_poll)(dev, ap->a_events, ap->a_p);
}
}
/* ARGSUSED */
diff --git a/sys/miscfs/specfs/specdev.h b/sys/miscfs/specfs/specdev.h
index 4218f80edca..bb95a71025d 100644
--- a/sys/miscfs/specfs/specdev.h
+++ b/sys/miscfs/specfs/specdev.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: specdev.h,v 1.16 2003/06/02 23:28:11 millert Exp $ */
+/* $OpenBSD: specdev.h,v 1.17 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: specdev.h,v 1.12 1996/02/13 13:13:01 mycroft Exp $ */
/*
@@ -92,7 +92,7 @@ int spec_read(void *);
int spec_write(void *);
#define spec_lease_check nullop
int spec_ioctl(void *);
-int spec_select(void *);
+int spec_poll(void *);
int spec_kqfilter(void *);
int spec_fsync(void *);
#define spec_remove spec_badop