summaryrefslogtreecommitdiff
path: root/sys
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
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')
-rw-r--r--sys/adosfs/advnops.c22
-rw-r--r--sys/arch/hp300/dev/grf.c11
-rw-r--r--sys/arch/hp300/dev/hil.c36
-rw-r--r--sys/arch/hp300/hp300/conf.c12
-rw-r--r--sys/arch/hppa/hppa/conf.c4
-rw-r--r--sys/arch/i386/i386/conf.c8
-rw-r--r--sys/arch/i386/include/conf.h10
-rw-r--r--sys/arch/mac68k/dev/adb.c28
-rw-r--r--sys/arch/mac68k/dev/adbvar.h4
-rw-r--r--sys/arch/mac68k/dev/asc.c19
-rw-r--r--sys/arch/mac68k/dev/ascvar.h4
-rw-r--r--sys/arch/mac68k/dev/grf.c12
-rw-r--r--sys/arch/mac68k/dev/grfvar.h4
-rw-r--r--sys/arch/macppc/include/conf.h4
-rw-r--r--sys/arch/mvme68k/mvme68k/conf.c4
-rw-r--r--sys/arch/mvme88k/mvme88k/conf.c4
-rw-r--r--sys/arch/sparc/dev/magma.c12
-rw-r--r--sys/arch/sparc/dev/spif.c10
-rw-r--r--sys/arch/sparc/include/conf.h8
-rw-r--r--sys/arch/sparc64/include/conf.h8
-rw-r--r--sys/arch/vax/uba/qv.c45
-rw-r--r--sys/arch/vax/vax/conf.c12
-rw-r--r--sys/compat/svr4/svr4_net.c4
-rw-r--r--sys/crypto/cryptodev.c12
-rw-r--r--sys/dev/audio.c48
-rw-r--r--sys/dev/cons.c8
-rw-r--r--sys/dev/cons.h4
-rw-r--r--sys/dev/ic/com.c16
-rw-r--r--sys/dev/ic/comvar.h6
-rw-r--r--sys/dev/midi.c41
-rw-r--r--sys/dev/rnd.c22
-rw-r--r--sys/dev/sbus/magma.c10
-rw-r--r--sys/dev/sbus/spif.c10
-rw-r--r--sys/dev/sequencer.c33
-rw-r--r--sys/dev/systrace.c30
-rw-r--r--sys/dev/usb/usb_port.h8
-rw-r--r--sys/dev/wscons/wsdisplay.c6
-rw-r--r--sys/dev/wscons/wskbd.c4
-rw-r--r--sys/dev/wscons/wsmouse.c4
-rw-r--r--sys/dev/wscons/wsmux.c4
-rw-r--r--sys/isofs/cd9660/cd9660_node.h4
-rw-r--r--sys/isofs/cd9660/cd9660_vnops.c15
-rw-r--r--sys/kern/kern_event.c17
-rw-r--r--sys/kern/spec_vnops.c17
-rw-r--r--sys/kern/subr_log.c24
-rw-r--r--sys/kern/sys_generic.c71
-rw-r--r--sys/kern/sys_pipe.c67
-rw-r--r--sys/kern/sys_socket.c61
-rw-r--r--sys/kern/tty.c43
-rw-r--r--sys/kern/tty_pty.c85
-rw-r--r--sys/kern/tty_tty.c12
-rw-r--r--sys/kern/vfs_vnops.c16
-rw-r--r--sys/miscfs/deadfs/dead_vnops.c19
-rw-r--r--sys/miscfs/fdesc/fdesc_vnops.c23
-rw-r--r--sys/miscfs/fifofs/fifo.h4
-rw-r--r--sys/miscfs/fifofs/fifo_vnops.c32
-rw-r--r--sys/miscfs/kernfs/kernfs.h3
-rw-r--r--sys/miscfs/kernfs/kernfs_vnops.c19
-rw-r--r--sys/miscfs/portal/portal_vnops.c20
-rw-r--r--sys/miscfs/procfs/procfs.h3
-rw-r--r--sys/miscfs/procfs/procfs_vnops.c18
-rw-r--r--sys/miscfs/specfs/spec_vnops.c17
-rw-r--r--sys/miscfs/specfs/specdev.h4
-rw-r--r--sys/miscfs/union/union_vnops.c16
-rw-r--r--sys/msdosfs/denode.h4
-rw-r--r--sys/msdosfs/msdosfs_vnops.c17
-rw-r--r--sys/net/bpf.c44
-rw-r--r--sys/net/if_tun.c33
-rw-r--r--sys/net/ppp_tty.c4
-rw-r--r--sys/nfs/nfs_vnops.c4
-rw-r--r--sys/nfs/nfsnode.h4
-rw-r--r--sys/sys/conf.h100
-rw-r--r--sys/sys/file.h4
-rw-r--r--sys/sys/socketvar.h4
-rw-r--r--sys/sys/specdev.h4
-rw-r--r--sys/sys/tty.h6
-rw-r--r--sys/ufs/ext2fs/ext2fs_vnops.c4
-rw-r--r--sys/ufs/ffs/ffs_vnops.c4
-rw-r--r--sys/ufs/lfs/lfs_vnops.c4
-rw-r--r--sys/ufs/mfs/mfs_vnops.c4
-rw-r--r--sys/ufs/mfs/mfsnode.h4
-rw-r--r--sys/ufs/ufs/ufs_extern.h4
-rw-r--r--sys/ufs/ufs/ufs_vnops.c15
-rw-r--r--sys/xfs/xfs_vopdefs.h4
84 files changed, 715 insertions, 717 deletions
diff --git a/sys/adosfs/advnops.c b/sys/adosfs/advnops.c
index e02a102e27c..a6b8350d464 100644
--- a/sys/adosfs/advnops.c
+++ b/sys/adosfs/advnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: advnops.c,v 1.25 2003/07/24 22:00:24 mickey Exp $ */
+/* $OpenBSD: advnops.c,v 1.26 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: advnops.c,v 1.32 1996/10/13 02:52:09 christos Exp $ */
/*
@@ -44,6 +44,7 @@
#include <sys/malloc.h>
#include <sys/stat.h>
#include <sys/unistd.h>
+#include <sys/poll.h>
#include <sys/proc.h>
#include <machine/endian.h>
@@ -57,7 +58,7 @@ int adosfs_getattr(void *);
int adosfs_read(void *);
int adosfs_write(void *);
int adosfs_ioctl(void *);
-int adosfs_select(void *);
+int adosfs_poll(void *);
int adosfs_strategy(void *);
int adosfs_link(void *);
int adosfs_symlink(void *);
@@ -107,7 +108,7 @@ struct vnodeopv_entry_desc adosfs_vnodeop_entries[] = {
{ &vop_write_desc, adosfs_write }, /* write */
{ &vop_lease_desc, adosfs_lease_check }, /* lease */
{ &vop_ioctl_desc, adosfs_ioctl }, /* ioctl */
- { &vop_select_desc, adosfs_select }, /* select */
+ { &vop_poll_desc, adosfs_poll }, /* poll */
{ &vop_fsync_desc, adosfs_fsync }, /* fsync */
{ &vop_remove_desc, adosfs_remove }, /* remove */
{ &vop_link_desc, adosfs_link }, /* link */
@@ -376,24 +377,23 @@ adosfs_ioctl(v)
/* ARGSUSED */
int
-adosfs_select(v)
+adosfs_poll(v)
void *v;
{
-#ifdef ADOSFS_DIAGNOSTIC
- 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;
} */ *sp = v;
+#ifdef ADOSFS_DIAGNOSTIC
/*
* sure there's something to read...
*/
advopprint(sp);
- printf(" 1)");
+ printf(" %d",
+ ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
#endif
- return(1);
+ return(ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
}
/*
diff --git a/sys/arch/hp300/dev/grf.c b/sys/arch/hp300/dev/grf.c
index 8f4cc5709db..eb204fd152d 100644
--- a/sys/arch/hp300/dev/grf.c
+++ b/sys/arch/hp300/dev/grf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf.c,v 1.22 2003/06/02 23:27:44 millert Exp $ */
+/* $OpenBSD: grf.c,v 1.23 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: grf.c,v 1.30 1998/08/20 08:33:41 kleink Exp $ */
/*
@@ -53,6 +53,7 @@
#include <sys/ioctl.h>
#include <sys/malloc.h>
#include <sys/mman.h>
+#include <sys/poll.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/vnode.h>
@@ -284,14 +285,12 @@ grfioctl(dev, cmd, data, flag, p)
/*ARGSUSED*/
int
-grfselect(dev, rw, p)
+grfpoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
- if (rw == FREAD)
- return(0);
- return(1);
+ return (events & (POLLOUT | POLLWRNORM));
}
/*ARGSUSED*/
diff --git a/sys/arch/hp300/dev/hil.c b/sys/arch/hp300/dev/hil.c
index 0785e4f08bb..2403c8f30d5 100644
--- a/sys/arch/hp300/dev/hil.c
+++ b/sys/arch/hp300/dev/hil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hil.c,v 1.18 2003/06/02 23:27:44 millert Exp $ */
+/* $OpenBSD: hil.c,v 1.19 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: hil.c,v 1.34 1997/04/02 22:37:32 scottr Exp $ */
/*
@@ -46,6 +46,7 @@
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/kernel.h>
+#include <sys/poll.h>
#include <sys/proc.h>
#include <sys/tty.h>
#include <sys/uio.h>
@@ -735,19 +736,21 @@ hilmmap(dev, off, prot)
/*ARGSUSED*/
int
-hilselect(dev, rw, p)
+hilpoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
struct hilloopdev *dptr;
struct hiliqueue *qp;
int mask;
- int s, device;
+ int s, revents, device;
+
+ revents = events & (POLLOUT | POLLWRNORM);
+ if (events & (POLLIN | POLLRDNORM) == 0)
+ return (revents);
- if (rw == FWRITE)
- return (1);
device = HILUNIT(dev);
/*
@@ -757,13 +760,12 @@ hilselect(dev, rw, p)
dptr = &hilp->hl_device[device];
if (dptr->hd_flags & HIL_READIN) {
s = splhil();
- if (dptr->hd_queue.c_cc) {
- splx(s);
- return (1);
- }
- selrecord(p, &dptr->hd_selr);
+ if (dptr->hd_queue.c_cc)
+ revents |= events & (POLLIN | POLLRDNORM);
+ else
+ selrecord(p, &dptr->hd_selr);
splx(s);
- return (0);
+ return (revents);
}
/*
@@ -772,7 +774,7 @@ hilselect(dev, rw, p)
* This is primarily to be consistant with HP-UX.
*/
if (device && (dptr->hd_flags & (HIL_ALIVE|HIL_PSEUDO)) != HIL_ALIVE)
- return (1);
+ return (revents | (events & (POLLIN | POLLRDNORM)));
/*
* Select on loop device is special.
@@ -792,12 +794,12 @@ hilselect(dev, rw, p)
qp->hq_eventqueue->hil_evqueue.head !=
qp->hq_eventqueue->hil_evqueue.tail) {
splx(s);
- return (1);
+ return (revents | (events & (POLLIN | POLLRDNORM)));
}
selrecord(p, &dptr->hd_selr);
splx(s);
- return (0);
+ return (revents);
}
/*ARGSUSED*/
@@ -985,7 +987,7 @@ hilevent(hilp)
}
/*
- * Wake up anyone selecting on this device or the loop itself
+ * Wake up anyone polling this device or the loop itself
*/
selwakeup(&dptr->hd_selr);
dptr = &hilp->hl_device[HILLOOPDEV];
@@ -1026,7 +1028,7 @@ hpuxhilevent(hilp, dptr)
}
/*
- * Wake up any one blocked on a read or select
+ * Wake up any one blocked on a read or poll
*/
if (dptr->hd_flags & HIL_ASLEEP) {
dptr->hd_flags &= ~HIL_ASLEEP;
diff --git a/sys/arch/hp300/hp300/conf.c b/sys/arch/hp300/hp300/conf.c
index 92d6b952c7e..41b386845d1 100644
--- a/sys/arch/hp300/hp300/conf.c
+++ b/sys/arch/hp300/hp300/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.33 2003/06/02 23:27:45 millert Exp $ */
+/* $OpenBSD: conf.c,v 1.34 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: conf.c,v 1.39 1997/05/12 08:17:53 thorpej Exp $ */
/*-
@@ -72,24 +72,24 @@ struct bdevsw bdevsw[] =
};
int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
-/* open, close, ioctl, select, mmap -- XXX should be a map device */
+/* open, close, ioctl, poll, mmap -- XXX should be a map device */
#define cdev_grf_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
(dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
+ (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
dev_init(c,n,mmap) }
/* open, close, read, write, ioctl -- XXX should be a generic device */
#define cdev_ppi_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
- 0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev }
+ 0, (dev_type_poll((*))) enodev, (dev_type_mmap((*))) enodev }
-/* open, close, read, ioctl, select, mmap -- XXX should be a map device */
+/* open, close, read, ioctl, poll, mmap -- XXX should be a map device */
#define cdev_hil_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
(dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
+ (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
dev_init(c,n,mmap) }
#define mmread mmrw
diff --git a/sys/arch/hppa/hppa/conf.c b/sys/arch/hppa/hppa/conf.c
index 3194c57608c..3512d799611 100644
--- a/sys/arch/hppa/hppa/conf.c
+++ b/sys/arch/hppa/hppa/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.27 2003/06/02 23:27:46 millert Exp $ */
+/* $OpenBSD: conf.c,v 1.28 2003/09/23 16:51:11 millert Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -82,7 +82,7 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
#define cdev_wscons_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
- dev_init(c,n,tty), ttselect /* ttpoll */, dev_init(c,n,mmap) }
+ dev_init(c,n,tty), ttpoll, dev_init(c,n,mmap) }
#include "audio.h"
#include "pty.h"
diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c
index a8d775969d8..3d45ae2d281 100644
--- a/sys/arch/i386/i386/conf.c
+++ b/sys/arch/i386/i386/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.103 2003/06/27 16:57:14 nate Exp $ */
+/* $OpenBSD: conf.c,v 1.104 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: conf.c,v 1.75 1996/05/03 19:40:20 christos Exp $ */
/*
@@ -93,7 +93,7 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
#define cdev_pc_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
- dev_init(c,n,tty), ttselect, dev_init(c,n,mmap), D_TTY }
+ dev_init(c,n,tty), ttpoll, dev_init(c,n,mmap), D_TTY }
/* open, close, read, ioctl */
#define cdev_joy_init(c,n) { \
@@ -109,11 +109,11 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
(dev_type_stop((*))) enodev, 0, seltrue, \
(dev_type_mmap((*))) enodev, 0 }
-/* open, close, ioctl, select -- XXX should be a generic device */
+/* open, close, ioctl, poll -- XXX should be a generic device */
#define cdev_ocis_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
+ (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
(dev_type_mmap((*))) enodev, 0 }
/* open, close, read, ioctl */
diff --git a/sys/arch/i386/include/conf.h b/sys/arch/i386/include/conf.h
index c28c43c8906..82a4f670620 100644
--- a/sys/arch/i386/include/conf.h
+++ b/sys/arch/i386/include/conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.9 2002/06/11 05:15:19 miod Exp $ */
+/* $OpenBSD: conf.h,v 1.10 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */
/*
@@ -44,7 +44,7 @@ cdev_decl(fd);
#define cdev_pc_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
- dev_init(c,n,tty), ttselect, dev_init(c,n,mmap), D_TTY }
+ dev_init(c,n,tty), ttpoll, dev_init(c,n,mmap), D_TTY }
cdev_decl(pc);
@@ -52,7 +52,7 @@ cdev_decl(pc);
#define cdev_apm_init(c,n) {\
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev, D_KQFILTER, dev_init(c,n,kqfilter) }
cdev_decl(spkr);
@@ -65,10 +65,10 @@ cdev_decl(pms);
cdev_decl(joy);
-#define biosselect seltrue
+#define biospoll seltrue
cdev_decl(bios);
cdev_decl(apm);
-#define pctrselect seltrue
+#define pctrpoll seltrue
cdev_decl(pctr);
diff --git a/sys/arch/mac68k/dev/adb.c b/sys/arch/mac68k/dev/adb.c
index b70007c3a7f..cb421922eda 100644
--- a/sys/arch/mac68k/dev/adb.c
+++ b/sys/arch/mac68k/dev/adb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb.c,v 1.12 2002/03/14 01:26:35 millert Exp $ */
+/* $OpenBSD: adb.c,v 1.13 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: adb.c,v 1.13 1996/12/16 16:17:02 scottr Exp $ */
/*-
@@ -36,6 +36,7 @@ e* notice, this list of conditions and the following disclaimer in the
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/select.h>
+#include <sys/poll.h>
#include <sys/proc.h>
#include <sys/signalvar.h>
#include <sys/systm.h>
@@ -540,23 +541,24 @@ adbioctl(dev, cmd, data, flag, p)
int
-adbselect(dev, rw, p)
+adbpoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
- switch (rw) {
- case FREAD:
+ int revents = 0;
+
+ if (events & (POLLIN | POLLRDNORM)) {
/* succeed if there is something to read */
if (adb_evq_len > 0)
- return (1);
- selrecord(p, &adb_selinfo);
- break;
-
- case FWRITE:
- return (1); /* always fails => never blocks */
- break;
+ revents |= events & (POLLIN | POLLRDNORM);
+ else
+ selrecord(p, &adb_selinfo);
+ }
+ if (events & (POLLOUT | POLLWRNORM)) {
+ /* always fails => never blocks */
+ revents |= events & (POLLOUT | POLLWRNORM);
}
- return (0);
+ return (revents);
}
diff --git a/sys/arch/mac68k/dev/adbvar.h b/sys/arch/mac68k/dev/adbvar.h
index b52a04df698..67e40f1fcbd 100644
--- a/sys/arch/mac68k/dev/adbvar.h
+++ b/sys/arch/mac68k/dev/adbvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: adbvar.h,v 1.7 2002/03/14 01:26:35 millert Exp $ */
+/* $OpenBSD: adbvar.h,v 1.8 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: adbvar.h,v 1.5 1997/01/13 07:01:24 scottr Exp $ */
/*-
@@ -58,7 +58,7 @@ int adbclose(dev_t dev, int flag, int mode, struct proc *p);
int adbread(dev_t dev, struct uio *uio, int flag);
int adbwrite(dev_t dev, struct uio *uio, int flag);
int adbioctl(dev_t , int , caddr_t , int , struct proc *);
-int adbselect(dev_t dev, int rw, struct proc *p);
+int adbpoll(dev_t dev, int rw, struct proc *p);
/* adbsysadm.s */
void extdms_complete(void);
diff --git a/sys/arch/mac68k/dev/asc.c b/sys/arch/mac68k/dev/asc.c
index 95bdb93b8a8..87950d796f3 100644
--- a/sys/arch/mac68k/dev/asc.c
+++ b/sys/arch/mac68k/dev/asc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asc.c,v 1.15 2002/06/24 22:14:47 miod Exp $ */
+/* $OpenBSD: asc.c,v 1.16 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: asc.c,v 1.20 1997/02/24 05:47:33 scottr Exp $ */
/*
@@ -76,6 +76,7 @@
#include <sys/param.h>
#include <sys/device.h>
#include <sys/fcntl.h>
+#include <sys/poll.h>
#include <sys/timeout.h>
#include <uvm/uvm_extern.h>
@@ -255,21 +256,13 @@ ascioctl(dev, cmd, data, flag, p)
}
int
-ascselect(dev, rw, p)
+ascpoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
- switch (rw) {
- case FREAD:
- break;
-
- case FWRITE:
- return (1); /* always fails => never blocks */
- break;
- }
-
- return (0);
+ /* always fails => never blocks */
+ return (events & (POLLOUT | POLLWRNORM));
}
paddr_t
diff --git a/sys/arch/mac68k/dev/ascvar.h b/sys/arch/mac68k/dev/ascvar.h
index 7c1c2c30f16..3d4e12670b0 100644
--- a/sys/arch/mac68k/dev/ascvar.h
+++ b/sys/arch/mac68k/dev/ascvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ascvar.h,v 1.5 2002/03/14 01:26:35 millert Exp $ */
+/* $OpenBSD: ascvar.h,v 1.6 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: ascvar.h,v 1.3 1997/02/24 05:47:34 scottr Exp $ */
/*
@@ -47,5 +47,5 @@ int ascclose(dev_t dev, int flag, int mode, struct proc *p);
int ascread(dev_t, struct uio *, int);
int ascwrite(dev_t, struct uio *, int);
int ascioctl(dev_t, int, caddr_t, int, struct proc *p);
-int ascselect(dev_t dev, int rw, struct proc *p);
+int ascpoll(dev_t dev, int rw, struct proc *p);
paddr_t ascmmap(dev_t dev, off_t off, int prot);
diff --git a/sys/arch/mac68k/dev/grf.c b/sys/arch/mac68k/dev/grf.c
index 8f9de859806..192ede24f2b 100644
--- a/sys/arch/mac68k/dev/grf.c
+++ b/sys/arch/mac68k/dev/grf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf.c,v 1.24 2003/06/02 23:27:48 millert Exp $ */
+/* $OpenBSD: grf.c,v 1.25 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: grf.c,v 1.41 1997/02/24 06:20:04 scottr Exp $ */
/*
@@ -52,6 +52,7 @@
#include <sys/file.h>
#include <sys/malloc.h>
#include <sys/mman.h>
+#include <sys/poll.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/vnode.h>
@@ -254,14 +255,13 @@ grfioctl(dev, cmd, data, flag, p)
/*ARGSUSED*/
int
-grfselect(dev, rw, p)
+grfpoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
- if (rw == FREAD)
- return (0);
- return (1);
+ /* always fails => never blocks */
+ return (events & (POLLOUT | POLLWRNORM));
}
/*ARGSUSED*/
diff --git a/sys/arch/mac68k/dev/grfvar.h b/sys/arch/mac68k/dev/grfvar.h
index 05aaafe1641..a69b4d5735d 100644
--- a/sys/arch/mac68k/dev/grfvar.h
+++ b/sys/arch/mac68k/dev/grfvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: grfvar.h,v 1.12 2003/06/02 23:27:48 millert Exp $ */
+/* $OpenBSD: grfvar.h,v 1.13 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: grfvar.h,v 1.11 1996/08/04 06:03:58 scottr Exp $ */
/*
@@ -139,7 +139,7 @@ struct image_data {
int grfopen(dev_t dev, int flag, int mode, struct proc *p);
int grfclose(dev_t dev, int flag, int mode, struct proc *p);
int grfioctl(dev_t, int, caddr_t, int, struct proc *p);
-int grfselect(dev_t dev, int rw, struct proc *p);
+int grfpoll(dev_t dev, int rw, struct proc *p);
paddr_t grfmmap(dev_t dev, off_t off, int prot);
int grfon(dev_t dev);
int grfoff(dev_t dev);
diff --git a/sys/arch/macppc/include/conf.h b/sys/arch/macppc/include/conf.h
index 43a411db94c..0a339454816 100644
--- a/sys/arch/macppc/include/conf.h
+++ b/sys/arch/macppc/include/conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.8 2002/09/15 09:01:58 deraadt Exp $ */
+/* $OpenBSD: conf.h,v 1.9 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */
/*
@@ -40,7 +40,7 @@ cdev_decl(mm);
#define cdev_apm_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev, D_KQFILTER, dev_init(c,n,kqfilter) }
cdev_decl(aed);
diff --git a/sys/arch/mvme68k/mvme68k/conf.c b/sys/arch/mvme68k/mvme68k/conf.c
index 5962860b323..8e1db78e72b 100644
--- a/sys/arch/mvme68k/mvme68k/conf.c
+++ b/sys/arch/mvme68k/mvme68k/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.34 2003/06/02 23:27:50 millert Exp $ */
+/* $OpenBSD: conf.c,v 1.35 2003/09/23 16:51:11 millert Exp $ */
/*-
* Copyright (c) 1995 Theo de Raadt
@@ -129,7 +129,7 @@ cdev_decl(fd);
#define cdev_mdev_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
dev_init(c,n,mmap) }
#include "lp.h"
diff --git a/sys/arch/mvme88k/mvme88k/conf.c b/sys/arch/mvme88k/mvme88k/conf.c
index cc578bec58c..83de6cdf31d 100644
--- a/sys/arch/mvme88k/mvme88k/conf.c
+++ b/sys/arch/mvme88k/mvme88k/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.26 2003/06/02 23:27:52 millert Exp $ */
+/* $OpenBSD: conf.c,v 1.27 2003/09/23 16:51:11 millert Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -87,7 +87,7 @@ cdev_decl(flash);
#define cdev_mdev_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
dev_init(c,n,mmap) }
#if notyet
diff --git a/sys/arch/sparc/dev/magma.c b/sys/arch/sparc/dev/magma.c
index 60c457aa1bd..d6c52594442 100644
--- a/sys/arch/sparc/dev/magma.c
+++ b/sys/arch/sparc/dev/magma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: magma.c,v 1.15 2003/08/15 20:32:14 tedu Exp $ */
+/* $OpenBSD: magma.c,v 1.16 2003/09/23 16:51:11 millert Exp $ */
/*
* magma.c
*
@@ -1398,7 +1398,7 @@ int s, opt;
* mbppread read from mbpp
* mbppwrite write to mbpp
* mbppioctl do ioctl on mbpp
- * mbppselect do select on mbpp
+ * mbpppoll do poll on mbpp
* mbpp_rw general rw routine
* mbpp_timeout rw timeout
* mbpp_start rw start after delay
@@ -1589,15 +1589,15 @@ int s;
}
/*
- * select routine
+ * poll routine
*/
int
-mbppselect(dev, rw, p)
+mbpppoll(dev, events, p)
dev_t dev;
-int rw;
+int events;
struct proc *p;
{
- return(ENODEV);
+ return(seltrue(dev, events, p));
}
int
diff --git a/sys/arch/sparc/dev/spif.c b/sys/arch/sparc/dev/spif.c
index c56255e8a49..6642bcc5d81 100644
--- a/sys/arch/sparc/dev/spif.c
+++ b/sys/arch/sparc/dev/spif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spif.c,v 1.16 2003/08/15 20:32:14 tedu Exp $ */
+/* $OpenBSD: spif.c,v 1.17 2003/09/23 16:51:11 millert Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
@@ -97,7 +97,7 @@ int sbppread(dev_t, struct uio *, int);
int sbppwrite(dev_t, struct uio *, int);
int sbpp_rw(dev_t, struct uio *);
int spifppcintr(void *);
-int sbppselect(dev_t, int, struct proc *);
+int sbpppoll(dev_t, int, struct proc *);
int sbppioctl(dev_t, u_long, caddr_t, int, struct proc *);
struct cfattach spif_ca = {
@@ -1075,12 +1075,12 @@ sbpp_rw(dev, uio)
}
int
-sbppselect(dev, rw, p)
+sbpppoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
- return (ENODEV);
+ return (seltrue(dev, events, p));
}
int
diff --git a/sys/arch/sparc/include/conf.h b/sys/arch/sparc/include/conf.h
index bc817336879..ee7e8d4298c 100644
--- a/sys/arch/sparc/include/conf.h
+++ b/sys/arch/sparc/include/conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.17 2003/04/13 22:55:51 miod Exp $ */
+/* $OpenBSD: conf.h,v 1.18 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: conf.h,v 1.8 1996/12/31 07:12:43 mrg Exp $ */
/*
@@ -38,7 +38,7 @@ cdev_decl(mm);
#define cdev_openprom_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) nullop, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) nullop, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev }
cdev_decl(openprom);
@@ -48,11 +48,11 @@ cdev_decl(zs);
bdev_decl(fd);
cdev_decl(fd);
-/* open, close, read, write, ioctl, select */
+/* open, close, read, write, ioctl, poll */
#define cdev_gen_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
- 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev }
+ 0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev }
bdev_decl(xd);
cdev_decl(xd);
diff --git a/sys/arch/sparc64/include/conf.h b/sys/arch/sparc64/include/conf.h
index 8d36949babd..bdea4f9a9e9 100644
--- a/sys/arch/sparc64/include/conf.h
+++ b/sys/arch/sparc64/include/conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.13 2002/07/10 22:21:30 mickey Exp $ */
+/* $OpenBSD: conf.h,v 1.14 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: conf.h,v 1.9 2001/03/26 12:33:26 lukem Exp $ */
/*-
@@ -47,7 +47,7 @@ cdev_decl(openprom);
#define cdev_openprom_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) nullop, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) nullop, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev }
cdev_decl(uperf);
@@ -56,13 +56,13 @@ cdev_decl(uperf);
#define cdev_uperf_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) nullop, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) nullop, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev }
#define cdev_gen_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
- 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev }
+ 0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev }
cdev_decl(cn);
diff --git a/sys/arch/vax/uba/qv.c b/sys/arch/vax/uba/qv.c
index 980be7646e9..e24a65bf29a 100644
--- a/sys/arch/vax/uba/qv.c
+++ b/sys/arch/vax/uba/qv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qv.c,v 1.6 2003/06/02 23:27:58 millert Exp $ */
+/* $OpenBSD: qv.c,v 1.7 2003/09/23 16:51:11 millert Exp $ */
/* $NetBSD: qv.c,v 1.2 1996/09/02 06:44:28 mycroft Exp $ */
/*-
@@ -142,6 +142,7 @@
#include "sys/uio.h"
#include "sys/kernel.h"
#include "sys/syslog.h"
+#include "sys/poll.h"
#include "../include/cpu.h"
#include "../include/mtpr.h"
#include "ubareg.h"
@@ -494,33 +495,31 @@ qvwrite(dev, uio)
/*
- * Mouse activity select routine
+ * Mouse activity poll routine
*/
-qvselect(dev, rw)
-dev_t dev;
+int
+qvpoll(dev, events, p)
+ dev_t dev;
+ int events;
+ struct proc *p;
{
- register int s = spl5();
- register struct qv_info *qp = qv_scn;
+ struct qv_info *qp = qv_scn;
+ int revents = 0;
+ int s = spl5();
- if( QVCHAN(minor(dev)) == QVMOUSECHAN )
- switch(rw) {
- case FREAD: /* if events okay */
- if(qp->ihead != qp->itail) {
- splx(s);
- return(1);
- }
- qvrsel = u.u_procp;
- splx(s);
- return(0);
- default: /* can never write */
- splx(s);
- return(0);
- }
- else {
+ if (QVCHAN(minor(dev)) != QVMOUSECHAN) {
splx(s);
- return( ttselect(dev, rw) );
+ return(ttpoll(dev, events, p));
+ }
+
+ if (events & (POLLIN | POLLRDNORM)) {
+ if (qp->ihead != qp->itail)
+ revents |= events & (POLLIN | POLLRDNORM);
+ else
+ qvrsel = u.u_procp;
}
- /*NOTREACHED*/
+ splx(s);
+ return(revents);
}
/*
diff --git a/sys/arch/vax/vax/conf.c b/sys/arch/vax/vax/conf.c
index e3ba6533630..b1fbebb1460 100644
--- a/sys/arch/vax/vax/conf.c
+++ b/sys/arch/vax/vax/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.41 2003/06/26 13:06:26 miod Exp $ */
+/* $OpenBSD: conf.c,v 1.42 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: conf.c,v 1.44 1999/10/27 16:38:54 ragge Exp $ */
/*-
@@ -199,17 +199,17 @@ struct consdev constab[]={
/* Special for console storage */
#define dev_type_rw(n) int n(dev_t, int, int, struct proc *)
-/* plotters - open, close, write, ioctl, select*/
+/* plotters - open, close, write, ioctl, poll*/
#define cdev_plotter_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev }
+ 0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev }
/* console mass storage - open, close, read/write */
#define cdev_cnstore_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), (dev_type_ioctl((*))) enodev, \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev }
#define cdev_lp_init(c,n) { \
@@ -221,13 +221,13 @@ struct consdev constab[]={
#define cdev_graph_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
- 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev }
+ 0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev }
/* Ingres */
#define cdev_ingres_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
(dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) nullop, 0, (dev_type_select((*))) nullop, \
+ (dev_type_stop((*))) nullop, 0, (dev_type_poll((*))) nullop, \
(dev_type_mmap((*))) enodev }
#define mmread mmrw
diff --git a/sys/compat/svr4/svr4_net.c b/sys/compat/svr4/svr4_net.c
index a4caf5cfac2..2accdd81afe 100644
--- a/sys/compat/svr4/svr4_net.c
+++ b/sys/compat/svr4/svr4_net.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svr4_net.c,v 1.15 2002/03/14 01:26:51 millert Exp $ */
+/* $OpenBSD: svr4_net.c,v 1.16 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: svr4_net.c,v 1.12 1996/09/07 12:40:51 mycroft Exp $ */
/*
@@ -82,7 +82,7 @@ int svr4_netattach(int);
static int svr4_soo_close(struct file *fp, struct proc *p);
static struct fileops svr4_netops = {
- soo_read, soo_write, soo_ioctl, soo_select, soo_kqfilter,
+ soo_read, soo_write, soo_ioctl, soo_poll, soo_kqfilter,
soo_stat, svr4_soo_close
};
diff --git a/sys/crypto/cryptodev.c b/sys/crypto/cryptodev.c
index 001edcf5fe8..38307d4c606 100644
--- a/sys/crypto/cryptodev.c
+++ b/sys/crypto/cryptodev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cryptodev.c,v 1.59 2003/06/10 18:34:51 jason Exp $ */
+/* $OpenBSD: cryptodev.c,v 1.60 2003/09/23 16:51:12 millert Exp $ */
/*
* Copyright (c) 2001 Theo de Raadt
@@ -86,7 +86,7 @@ void cryptoattach(int);
int cryptof_read(struct file *, off_t *, struct uio *, struct ucred *);
int cryptof_write(struct file *, off_t *, struct uio *, struct ucred *);
int cryptof_ioctl(struct file *, u_long, caddr_t, struct proc *p);
-int cryptof_select(struct file *, int, struct proc *);
+int cryptof_poll(struct file *, int, struct proc *);
int cryptof_kqfilter(struct file *, struct knote *);
int cryptof_stat(struct file *, struct stat *, struct proc *);
int cryptof_close(struct file *, struct proc *);
@@ -95,7 +95,7 @@ static struct fileops cryptofops = {
cryptof_read,
cryptof_write,
cryptof_ioctl,
- cryptof_select,
+ cryptof_poll,
cryptof_kqfilter,
cryptof_stat,
cryptof_close
@@ -585,7 +585,7 @@ fail:
/* ARGSUSED */
int
-cryptof_select(struct file *fp, int which, struct proc *p)
+cryptof_poll(struct file *fp, int events, struct proc *p)
{
return (0);
}
@@ -689,9 +689,9 @@ cryptoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
}
int
-cryptoselect(dev_t dev, int rw, struct proc *p)
+cryptopoll(dev_t dev, int events, struct proc *p)
{
- return (0);
+ return (seltrue(dev, events, p));
}
struct csession *
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index ea3f3018abf..05a07bba0df 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: audio.c,v 1.41 2003/01/26 23:16:14 jason Exp $ */
+/* $OpenBSD: audio.c,v 1.42 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: audio.c,v 1.105 1998/09/27 16:43:56 christos Exp $ */
/*
@@ -110,7 +110,7 @@ int audio_close(dev_t, int, int, struct proc *);
int audio_read(dev_t, struct uio *, int);
int audio_write(dev_t, struct uio *, int);
int audio_ioctl(dev_t, u_long, caddr_t, int, struct proc *);
-int audio_select(dev_t, int, struct proc *);
+int audio_poll(dev_t, int, struct proc *);
paddr_t audio_mmap(dev_t, off_t, int);
int mixer_open(dev_t, struct audio_softc *, int, int, struct proc *);
@@ -762,7 +762,7 @@ audioioctl(dev, cmd, addr, flag, p)
}
int
-audioselect(dev, events, p)
+audiopoll(dev, events, p)
dev_t dev;
int events;
struct proc *p;
@@ -782,7 +782,7 @@ audioselect(dev, events, p)
switch (AUDIODEV(dev)) {
case SOUND_DEVICE:
case AUDIO_DEVICE:
- error = audio_select(dev, events, p);
+ error = audio_poll(dev, events, p);
break;
case AUDIOCTL_DEVICE:
case MIXER_DEVICE:
@@ -1813,37 +1813,33 @@ audio_selwakeup(struct audio_softc *sc, int play)
(sc->sc_mode & AUMODE_RECORD || sc->sc_pr.used <= sc->sc_pr.usedlow)
int
-audio_select(dev, rw, p)
+audio_poll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
int unit = AUDIOUNIT(dev);
struct audio_softc *sc = audio_cd.cd_devs[unit];
- int rv, s = splaudio();
-
- DPRINTF(("audio_select: rw=0x%x mode=%d\n", rw, sc->sc_mode));
-
- switch (rw) {
+ int revents = 0, s = splaudio();
- case FREAD:
- rv = AUDIO_FILTREAD(sc);
- splx(s);
- if (rv)
- return (1);
- selrecord(p, &sc->sc_rsel);
- break;
+ DPRINTF(("audio_poll: events=0x%x mode=%d\n", events, sc->sc_mode));
- case FWRITE:
- rv = AUDIO_FILTWRITE(sc);
- splx(s);
- if (rv)
- return (1);
- selrecord(p, &sc->sc_wsel);
- break;
+ if (events & (POLLIN | POLLRDNORM)) {
+ if (AUDIO_FILTREAD(sc))
+ revents |= events & (POLLIN | POLLRDNORM);
+ }
+ if (events & (POLLOUT | POLLWRNORM)) {
+ if (AUDIO_FILTWRITE(sc))
+ revents |= events & (POLLOUT | POLLWRNORM);
+ }
+ if (revents == 0) {
+ if (events & (POLLIN | POLLRDNORM))
+ selrecord(p, &sc->sc_rsel);
+ if (events & (POLLOUT | POLLWRNORM))
+ selrecord(p, &sc->sc_wsel);
}
splx(s);
- return (0);
+ return (revents);
}
paddr_t
diff --git a/sys/dev/cons.c b/sys/dev/cons.c
index 7d4f72dffea..acd5ffd5909 100644
--- a/sys/dev/cons.c
+++ b/sys/dev/cons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cons.c,v 1.13 2003/08/15 20:32:16 tedu Exp $ */
+/* $OpenBSD: cons.c,v 1.14 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: cons.c,v 1.30 1996/04/08 19:57:30 jonathan Exp $ */
/*
@@ -203,14 +203,14 @@ cnioctl(dev, cmd, data, flag, p)
/*ARGSUSED*/
int
-cnselect(dev, rw, p)
+cnpoll(dev, rw, p)
dev_t dev;
int rw;
struct proc *p;
{
/*
- * Redirect the select, if that's appropriate.
+ * Redirect the poll, if that's appropriate.
* I don't want to think of the possible side effects
* of console redirection here.
*/
@@ -220,7 +220,7 @@ cnselect(dev, rw, p)
return ENXIO;
else
dev = cn_tab->cn_dev;
- return (ttselect(cn_tab->cn_dev, rw, p));
+ return (ttpoll(cn_tab->cn_dev, rw, p));
}
diff --git a/sys/dev/cons.h b/sys/dev/cons.h
index d35db22a99d..c19f27b88fc 100644
--- a/sys/dev/cons.h
+++ b/sys/dev/cons.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cons.h,v 1.12 2003/06/02 23:28:01 millert Exp $ */
+/* $OpenBSD: cons.h,v 1.13 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: cons.h,v 1.14 1996/03/14 19:08:35 christos Exp $ */
/*
@@ -79,7 +79,7 @@ int cnclose(dev_t, int, int, struct proc *);
int cnread(dev_t, struct uio *, int);
int cnwrite(dev_t, struct uio *, int);
int cnioctl(dev_t, u_long, caddr_t, int, struct proc *);
-int cnselect(dev_t, int, struct proc *);
+int cnpoll(dev_t, int, struct proc *);
int cnkqfilter(dev_t, struct knote *);
int cngetc(void);
void cnputc(int);
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index c451bb6db23..1d76f57cdfa 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com.c,v 1.92 2003/08/15 20:32:16 tedu Exp $ */
+/* $OpenBSD: com.c,v 1.93 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*
@@ -344,11 +344,11 @@ com_attach_subr(sc)
timeout_set(&sc->sc_diag_tmo, comdiag, sc);
timeout_set(&sc->sc_dtr_tmo, com_raisedtr, sc);
#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
- sc->sc_si = softintr_establish(IPL_TTY, compoll, sc);
+ sc->sc_si = softintr_establish(IPL_TTY, comsoft, sc);
if (sc->sc_si == NULL)
panic("%s: can't establish soft interrupt.", sc->sc_dev.dv_xname);
#else
- timeout_set(&sc->sc_poll_tmo, compoll, sc);
+ timeout_set(&sc->sc_comsoft_tmo, comsoft, sc);
#endif
/*
@@ -412,7 +412,7 @@ com_detach(self, flags)
#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
softintr_disestablish(sc->sc_si);
#else
- timeout_del(&sc->sc_poll_tmo);
+ timeout_del(&sc->sc_comsoft_tmo);
#endif
return (0);
@@ -516,7 +516,7 @@ comopen(dev, flag, mode, p)
ttsetwater(tp);
#ifndef __HAVE_GENERIC_SOFT_INTERRUPTS
- timeout_add(&sc->sc_poll_tmo, 1);
+ timeout_add(&sc->sc_comsoft_tmo, 1);
#endif
sc->sc_ibufp = sc->sc_ibuf = sc->sc_ibufs[0];
@@ -677,7 +677,7 @@ comclose(dev, flag, mode, p)
}
CLR(tp->t_state, TS_BUSY | TS_FLUSH);
#ifndef __HAVE_GENERIC_SOFT_INTERRUPTS
- timeout_del(&sc->sc_poll_tmo);
+ timeout_del(&sc->sc_comsoft_tmo);
#endif
sc->sc_cua = 0;
splx(s);
@@ -1148,7 +1148,7 @@ comdiag(arg)
}
void
-compoll(arg)
+comsoft(arg)
void *arg;
{
struct com_softc *sc = (struct com_softc *)arg;
@@ -1213,7 +1213,7 @@ compoll(arg)
out:
#ifndef __HAVE_GENERIC_SOFT_INTERRUPTS
- timeout_add(&sc->sc_poll_tmo, 1);
+ timeout_add(&sc->sc_comsoft_tmo, 1);
#else
;
#endif
diff --git a/sys/dev/ic/comvar.h b/sys/dev/ic/comvar.h
index e70a88dc68c..fa1e2e34b19 100644
--- a/sys/dev/ic/comvar.h
+++ b/sys/dev/ic/comvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: comvar.h,v 1.33 2003/07/15 03:15:58 jason Exp $ */
+/* $OpenBSD: comvar.h,v 1.34 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: comvar.h,v 1.5 1996/05/05 19:50:47 christos Exp $ */
/*
@@ -79,7 +79,7 @@ struct com_softc {
#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
void *sc_si;
#else
- struct timeout sc_poll_tmo;
+ struct timeout sc_comsoft_tmo;
#endif
int sc_overflows;
@@ -144,7 +144,7 @@ int comspeed(long, long);
u_char com_cflag2lcr(tcflag_t);
int comparam(struct tty *, struct termios *);
void comstart(struct tty *);
-void compoll(void *);
+void comsoft(void *);
struct consdev;
int comcnattach(bus_space_tag_t, int, int, int, tcflag_t);
diff --git a/sys/dev/midi.c b/sys/dev/midi.c
index 0f66c382e8b..710f59d1456 100644
--- a/sys/dev/midi.c
+++ b/sys/dev/midi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: midi.c,v 1.8 2002/03/14 01:26:52 millert Exp $ */
+/* $OpenBSD: midi.c,v 1.9 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: midi.c,v 1.10 1998/12/20 14:26:44 drochner Exp $ */
/*
@@ -695,37 +695,34 @@ midiioctl(dev, cmd, addr, flag, p)
}
int
-midiselect(dev, rw, p)
+midipoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
int unit = MIDIUNIT(dev);
struct midi_softc *sc = midi_cd.cd_devs[unit];
- int s = splaudio();
+ int revents = 0, s = splaudio();
- DPRINTF(("midiselect: %p rw=0x%x\n", sc, rw));
+ DPRINTF(("midipoll: %p events=0x%x\n", sc, events));
- switch (rw) {
- case FREAD:
- if (sc->inbuf.used > 0) {
- splx(s);
- return (1);
- }
- selrecord(p, &sc->rsel);
- break;
-
- case FWRITE:
- if (sc->outbuf.used < sc->outbuf.usedhigh) {
- splx(s);
- return (1);
- }
- selrecord(p, &sc->wsel);
- break;
+ if (events & (POLLIN | POLLRDNORM)) {
+ if (sc->inbuf.used > 0)
+ revents |= events & (POLLIN | POLLRDNORM);
+ }
+ if (events & (POLLOUT | POLLWRNORM)) {
+ if (sc->outbuf.used < sc->outbuf.usedhigh)
+ revents |= events & (POLLOUT | POLLWRNORM);
+ }
+ if (revents == 0) {
+ if (events & (POLLIN | POLLRDNORM))
+ selrecord(p, &sc->rsel);
+ if (events & (POLLOUT | POLLWRNORM))
+ selrecord(p, &sc->wsel);
}
splx(s);
- return (0);
+ return (revents);
}
void
diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c
index a90b8ebfde3..54b692e47a8 100644
--- a/sys/dev/rnd.c
+++ b/sys/dev/rnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rnd.c,v 1.63 2003/08/15 20:32:16 tedu Exp $ */
+/* $OpenBSD: rnd.c,v 1.64 2003/09/23 16:51:12 millert Exp $ */
/*
* rnd.c -- A strong random number generator
@@ -246,6 +246,7 @@
#include <sys/md5k.h>
#include <sys/sysctl.h>
#include <sys/timeout.h>
+#include <sys/poll.h>
#include <dev/rndvar.h>
#include <dev/rndioctl.h>
@@ -1021,22 +1022,23 @@ randomread(dev, uio, ioflag)
}
int
-randomselect(dev, rw, p)
+randompoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
- switch (rw) {
- case FREAD:
+ int revents = 0;
+
+ if (events & (POLLIN | POLLRDNORM)) {
if (random_state.entropy_count > 0)
- return (1);
+ revents |= events & (POLLIN | POLLRDNORM);
else
selrecord(p, &rnd_rsel);
- break;
- case FWRITE:
- return 1;
}
- return 0;
+ if (events & (POLLOUT | POLLWRNORM))
+ revents = events & (POLLOUT | POLLWRNORM); /* always writable */
+
+ return (revents);
}
int
diff --git a/sys/dev/sbus/magma.c b/sys/dev/sbus/magma.c
index 1faaf4f937c..222d1860015 100644
--- a/sys/dev/sbus/magma.c
+++ b/sys/dev/sbus/magma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: magma.c,v 1.11 2003/08/15 20:32:17 tedu Exp $ */
+/* $OpenBSD: magma.c,v 1.12 2003/09/23 16:51:12 millert Exp $ */
/*
* magma.c
*
@@ -1357,7 +1357,7 @@ mtty_param(struct tty *tp, struct termios *t)
* mbppread read from mbpp
* mbppwrite write to mbpp
* mbppioctl do ioctl on mbpp
- * mbppselect do select on mbpp
+ * mbpppoll do poll on mbpp
* mbpp_rw general rw routine
* mbpp_timeout rw timeout
* mbpp_start rw start after delay
@@ -1525,12 +1525,12 @@ mbppioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
}
/*
- * select routine
+ * poll routine
*/
int
-mbppselect(dev_t dev, int rw, struct proc *p)
+mbpppoll(dev_t dev, int events, struct proc *p)
{
- return (ENODEV);
+ return (seltrue(dev, events, p));
}
int
diff --git a/sys/dev/sbus/spif.c b/sys/dev/sbus/spif.c
index c559c31517d..1bcbd07e547 100644
--- a/sys/dev/sbus/spif.c
+++ b/sys/dev/sbus/spif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spif.c,v 1.10 2003/08/15 20:32:17 tedu Exp $ */
+/* $OpenBSD: spif.c,v 1.11 2003/09/23 16:51:12 millert Exp $ */
/*
* Copyright (c) 1999-2002 Jason L. Wright (jason@thought.net)
@@ -97,7 +97,7 @@ int sbppread(dev_t, struct uio *, int);
int sbppwrite(dev_t, struct uio *, int);
int sbpp_rw(dev_t, struct uio *);
int spifppcintr(void *);
-int sbppselect(dev_t, int, struct proc *);
+int sbpppoll(dev_t, int, struct proc *);
int sbppioctl(dev_t, u_long, caddr_t, int, struct proc *);
struct cfattach spif_ca = {
@@ -1127,12 +1127,12 @@ sbpp_rw(dev, uio)
}
int
-sbppselect(dev, rw, p)
+sbpppoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
- return (ENODEV);
+ return (seltrue(dev, events, p));
}
int
diff --git a/sys/dev/sequencer.c b/sys/dev/sequencer.c
index 75c56f9ded0..517a3fdc523 100644
--- a/sys/dev/sequencer.c
+++ b/sys/dev/sequencer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sequencer.c,v 1.8 2002/07/27 08:01:47 nordin Exp $ */
+/* $OpenBSD: sequencer.c,v 1.9 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: sequencer.c,v 1.13 1998/11/25 22:17:07 augustss Exp $ */
/*
@@ -632,30 +632,31 @@ sequencerioctl(dev, cmd, addr, flag, p)
}
int
-sequencerselect(dev, rw, p)
+sequencerpoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
struct sequencer_softc *sc = &seqdevs[SEQUENCERUNIT(dev)];
+ int revents = 0;
- DPRINTF(("sequencerselect: %p rw=0x%x\n", sc, rw));
+ DPRINTF(("sequencerpoll: %p rw=0x%x\n", sc, events));
- switch (rw) {
- case FREAD:
+ if (events & (POLLIN | POLLRDNORM)) {
if (!SEQ_QEMPTY(&sc->inq))
- return (1);
- selrecord(p, &sc->rsel);
- break;
-
- case FWRITE:
+ revents |= events & (POLLIN | POLLRDNORM);
+ }
+ if (events & (POLLOUT | POLLWRNORM)) {
if (SEQ_QLEN(&sc->outq) < sc->lowat)
- return (1);
- selrecord(p, &sc->wsel);
- break;
+ revents |= events & (POLLOUT | POLLWRNORM);
}
-
- return (0);
+ if (revents == 0) {
+ if (events & (POLLIN | POLLRDNORM))
+ selrecord(p, &sc->rsel);
+ if (events & (POLLOUT | POLLWRNORM))
+ selrecord(p, &sc->wsel);
+ }
+ return (revents);
}
void
diff --git a/sys/dev/systrace.c b/sys/dev/systrace.c
index d7c8972207d..0dfbbe5ff44 100644
--- a/sys/dev/systrace.c
+++ b/sys/dev/systrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: systrace.c,v 1.31 2003/08/15 20:32:16 tedu Exp $ */
+/* $OpenBSD: systrace.c,v 1.32 2003/09/23 16:51:12 millert Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -45,6 +45,7 @@
#include <sys/lock.h>
#include <sys/pool.h>
#include <sys/mount.h>
+#include <sys/poll.h>
#include <compat/common/compat_util.h>
@@ -59,14 +60,14 @@ int systraceclose(dev_t, int, int, struct proc *);
int systraceread(dev_t, struct uio *, int);
int systracewrite(dev_t, struct uio *, int);
int systraceioctl(dev_t, u_long, caddr_t, int, struct proc *);
-int systraceselect(dev_t, int, struct proc *);
+int systracepoll(dev_t, int, struct proc *);
uid_t systrace_seteuid(struct proc *, uid_t);
gid_t systrace_setegid(struct proc *, gid_t);
int systracef_read(struct file *, off_t *, struct uio *, struct ucred *);
int systracef_write(struct file *, off_t *, struct uio *, struct ucred *);
int systracef_ioctl(struct file *, u_long, caddr_t, struct proc *p);
-int systracef_select(struct file *, int, struct proc *);
+int systracef_poll(struct file *, int, struct proc *);
int systracef_kqfilter(struct file *, struct knote *);
int systracef_stat(struct file *, struct stat *, struct proc *);
int systracef_close(struct file *, struct proc *);
@@ -152,7 +153,7 @@ static struct fileops systracefops = {
systracef_read,
systracef_write,
systracef_ioctl,
- systracef_select,
+ systracef_poll,
systracef_kqfilter,
systracef_stat,
systracef_close
@@ -361,26 +362,27 @@ systracef_ioctl(fp, cmd, data, p)
/* ARGSUSED */
int
-systracef_select(fp, which, p)
+systracef_poll(fp, events, p)
struct file *fp;
- int which;
+ int events;
struct proc *p;
{
struct fsystrace *fst = (struct fsystrace *)fp->f_data;
- int ready = 0;
+ int revents = 0;
- if (which != FREAD)
+ if ((events & (POLLIN | POLLRDNORM)) == 0)
return (0);
systrace_lock();
lockmgr(&fst->lock, LK_EXCLUSIVE, NULL, p);
systrace_unlock();
- ready = TAILQ_FIRST(&fst->messages) != NULL;
- if (!ready)
+ if (!TAILQ_EMPTY(&fst->messages))
+ revents = events & (POLLIN | POLLRDNORM);
+ else
selrecord(p, &fst->si);
lockmgr(&fst->lock, LK_RELEASE, NULL, p);
- return (ready);
+ return (revents);
}
/* ARGSUSED */
@@ -558,12 +560,12 @@ systraceioctl(dev, cmd, data, flag, p)
}
int
-systraceselect(dev, rw, p)
+systracepoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
- return (0);
+ return (seltrue(dev, events, p));
}
void
diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h
index d5ed452ed1b..dfcdd5598b6 100644
--- a/sys/dev/usb/usb_port.h
+++ b/sys/dev/usb/usb_port.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: usb_port.h,v 1.44 2003/09/19 12:07:20 avsm Exp $ */
+/* $OpenBSD: usb_port.h,v 1.45 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: usb_port.h,v 1.62 2003/02/15 18:33:30 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.21 1999/11/17 22:33:47 n_hibma Exp $ */
@@ -286,12 +286,6 @@ typedef int usb_malloc_type;
#define if_deactivate(x)
#define IF_INPUT(ifp, m) ether_input_mbuf((ifp), (m))
-#define usbpoll usbselect
-#define uhidpoll uhidselect
-#define ugenpoll ugenselect
-#define uriopoll urioselect
-#define uscannerpoll uscannerselect
-
#define logprintf printf
#define swap_bytes_change_sign16_le swap_bytes_change_sign16
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index c998d9a09f0..b910c825fd3 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.50 2003/02/23 19:08:11 tedu Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.51 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: wsdisplay.c,v 1.37.4.1 2000/06/30 16:27:53 simonb Exp $ */
/*
@@ -1325,7 +1325,7 @@ wsdisplaymmap(dev, offset, prot)
}
int
-wsdisplayselect(dev, events, p)
+wsdisplaypoll(dev, events, p)
dev_t dev;
int events;
struct proc *p;
@@ -1339,7 +1339,7 @@ wsdisplayselect(dev, events, p)
scr = sc->sc_scr[WSDISPLAYSCREEN(dev)];
if (WSSCREEN_HAS_TTY(scr))
- return (ttselect(dev, events, p));
+ return (ttpoll(dev, events, p));
else
return (0);
}
diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c
index c163ff838c7..6f2cffced0d 100644
--- a/sys/dev/wscons/wskbd.c
+++ b/sys/dev/wscons/wskbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wskbd.c,v 1.36 2003/08/15 20:32:18 tedu Exp $ */
+/* $OpenBSD: wskbd.c,v 1.37 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: wskbd.c,v 1.38 2000/03/23 07:01:47 thorpej Exp $ */
/*
@@ -1075,7 +1075,7 @@ getkeyrepeat:
}
int
-wskbdselect(dev, events, p)
+wskbdpoll(dev, events, p)
dev_t dev;
int events;
struct proc *p;
diff --git a/sys/dev/wscons/wsmouse.c b/sys/dev/wscons/wsmouse.c
index da37afa5662..668eb55a39d 100644
--- a/sys/dev/wscons/wsmouse.c
+++ b/sys/dev/wscons/wsmouse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmouse.c,v 1.11 2003/06/02 23:28:04 millert Exp $ */
+/* $OpenBSD: wsmouse.c,v 1.12 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: wsmouse.c,v 1.12 2000/05/01 07:36:58 takemura Exp $ */
/*
@@ -638,7 +638,7 @@ wsmouse_do_ioctl(sc, cmd, data, flag, p)
#endif /* NWSMOUSE > 0 */
int
-wsmouseselect(dev, events, p)
+wsmousepoll(dev, events, p)
dev_t dev;
int events;
struct proc *p;
diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c
index 5d745573dae..a6af8aff3f6 100644
--- a/sys/dev/wscons/wsmux.c
+++ b/sys/dev/wscons/wsmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmux.c,v 1.10 2002/10/12 01:09:44 krw Exp $ */
+/* $OpenBSD: wsmux.c,v 1.11 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: wsmux.c,v 1.9 2000/05/28 10:33:14 takemura Exp $ */
/*
@@ -294,7 +294,7 @@ wsmuxioctl(dev, cmd, data, flag, p)
}
int
-wsmuxselect(dev, events, p)
+wsmuxpoll(dev, events, p)
dev_t dev;
int events;
struct proc *p;
diff --git a/sys/isofs/cd9660/cd9660_node.h b/sys/isofs/cd9660/cd9660_node.h
index c354ebb726f..b3fa1797baa 100644
--- a/sys/isofs/cd9660/cd9660_node.h
+++ b/sys/isofs/cd9660/cd9660_node.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660_node.h,v 1.15 2003/06/02 23:28:05 millert Exp $ */
+/* $OpenBSD: cd9660_node.h,v 1.16 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: cd9660_node.h,v 1.15 1997/04/11 21:52:01 kleink Exp $ */
/*-
@@ -115,7 +115,7 @@ int cd9660_getattr(void *);
int cd9660_setattr(void *);
int cd9660_read(void *);
int cd9660_ioctl(void *);
-int cd9660_select(void *);
+int cd9660_poll(void *);
int cd9660_mmap(void *);
int cd9660_seek(void *);
int cd9660_readdir(void *);
diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c
index b8462de93ba..5bf3fcecc97 100644
--- a/sys/isofs/cd9660/cd9660_vnops.c
+++ b/sys/isofs/cd9660/cd9660_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660_vnops.c,v 1.28 2003/06/02 23:28:05 millert Exp $ */
+/* $OpenBSD: cd9660_vnops.c,v 1.29 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: cd9660_vnops.c,v 1.42 1997/10/16 23:56:57 christos Exp $ */
/*-
@@ -54,6 +54,7 @@
#include <sys/ioctl.h>
#include <sys/ioccom.h>
#include <sys/cdio.h>
+#include <sys/poll.h>
#include <miscfs/fifofs/fifo.h>
#include <miscfs/specfs/specdev.h>
@@ -407,13 +408,19 @@ cd9660_ioctl(v)
/* ARGSUSED */
int
-cd9660_select(v)
+cd9660_poll(v)
void *v;
{
+ struct vop_poll_args /* {
+ struct vnode *a_vp;
+ int a_events;
+ struct proc *a_p;
+ } */ *ap = v;
+
/*
* We should really check to see if I/O is possible.
*/
- return (1);
+ return (seltrue(ap->a_vp->v_rdev, ap->a_events, ap->a_p));
}
/*
@@ -1038,7 +1045,7 @@ struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = {
{ &vop_write_desc, cd9660_write }, /* write */
{ &vop_lease_desc, cd9660_lease_check },/* lease */
{ &vop_ioctl_desc, cd9660_ioctl }, /* ioctl */
- { &vop_select_desc, cd9660_select }, /* select */
+ { &vop_poll_desc, cd9660_poll }, /* poll */
{ &vop_revoke_desc, cd9660_revoke }, /* revoke */
{ &vop_fsync_desc, cd9660_fsync }, /* fsync */
{ &vop_remove_desc, cd9660_remove }, /* remove */
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index b5d265159d7..368bc6c79b6 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_event.c,v 1.20 2003/08/15 20:32:18 tedu Exp $ */
+/* $OpenBSD: kern_event.c,v 1.21 2003/09/23 16:51:12 millert Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -48,6 +48,7 @@
#include <sys/stat.h>
#include <sys/uio.h>
#include <sys/mount.h>
+#include <sys/poll.h>
#include <sys/syscallargs.h>
int kqueue_scan(struct file *fp, int maxevents,
@@ -60,7 +61,7 @@ int kqueue_write(struct file *fp, off_t *poff, struct uio *uio,
struct ucred *cred);
int kqueue_ioctl(struct file *fp, u_long com, caddr_t data,
struct proc *p);
-int kqueue_select(struct file *fp, int which, struct proc *p);
+int kqueue_poll(struct file *fp, int events, struct proc *p);
int kqueue_kqfilter(struct file *fp, struct knote *kn);
int kqueue_stat(struct file *fp, struct stat *st, struct proc *p);
int kqueue_close(struct file *fp, struct proc *p);
@@ -70,7 +71,7 @@ struct fileops kqueueops = {
kqueue_read,
kqueue_write,
kqueue_ioctl,
- kqueue_select,
+ kqueue_poll,
kqueue_kqfilter,
kqueue_stat,
kqueue_close
@@ -700,22 +701,22 @@ kqueue_ioctl(struct file *fp, u_long com, caddr_t data, struct proc *p)
/*ARGSUSED*/
int
-kqueue_select(struct file *fp, int which, struct proc *p)
+kqueue_poll(struct file *fp, int events, struct proc *p)
{
struct kqueue *kq = (struct kqueue *)fp->f_data;
- int res = 0;
+ int revents = 0;
int s = splnet();
- if (which == FREAD) {
+ if (events & (POLLIN | POLLRDNORM)) {
if (kq->kq_count) {
- res = 1;
+ revents |= events & (POLLIN | POLLRDNORM);
} else {
selrecord(p, &kq->kq_sel);
kq->kq_state |= KQ_SEL;
}
}
splx(s);
- return (res);
+ return (revents);
}
/*ARGSUSED*/
diff --git a/sys/kern/spec_vnops.c b/sys/kern/spec_vnops.c
index f945ef378ca..c3e675b5905 100644
--- a/sys/kern/spec_vnops.c
+++ b/sys/kern/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/kern/subr_log.c b/sys/kern/subr_log.c
index 292bf55e35f..98eb65c87ca 100644
--- a/sys/kern/subr_log.c
+++ b/sys/kern/subr_log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_log.c,v 1.10 2003/07/21 22:44:50 tedu Exp $ */
+/* $OpenBSD: subr_log.c,v 1.11 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */
/*
@@ -46,6 +46,7 @@
#include <sys/signalvar.h>
#include <sys/syslog.h>
#include <sys/conf.h>
+#include <sys/poll.h>
#define LOG_RDPRI (PZERO + 1)
@@ -178,25 +179,22 @@ logread(dev, uio, flag)
/*ARGSUSED*/
int
-logselect(dev, rw, p)
+logpoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
+ int revents = 0;
int s = splhigh();
- switch (rw) {
-
- case FREAD:
- if (msgbufp->msg_bufr != msgbufp->msg_bufx) {
- splx(s);
- return (1);
- }
- selrecord(p, &logsoftc.sc_selp);
- break;
+ if (events & (POLLIN | POLLRDNORM)) {
+ if (msgbufp->msg_bufr != msgbufp->msg_bufx)
+ revents |= events & (POLLIN | POLLRDNORM);
+ else
+ selrecord(p, &logsoftc.sc_selp);
}
splx(s);
- return (0);
+ return (revents);
}
int
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 3a668bac241..713de532eaa 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_generic.c,v 1.45 2003/09/01 18:06:03 henning Exp $ */
+/* $OpenBSD: sys_generic.c,v 1.46 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */
/*
@@ -767,7 +767,7 @@ selscan(p, ibits, obits, nfd, retval)
register fd_mask bits;
struct file *fp;
int ni, n = 0;
- static int flag[3] = { FREAD, FWRITE, 0 };
+ static const int flag[3] = { POLLIN, POLLOUT, POLLPRI };
/*
* if nfd > FD_SETSIZE then the fd_set's contain nfd bits (rounded
@@ -788,7 +788,7 @@ selscan(p, ibits, obits, nfd, retval)
if ((fp = fd_getfile(fdp, fd)) == NULL)
return (EBADF);
FREF(fp);
- if ((*fp->f_ops->fo_select)(fp, flag[msk], p)) {
+ if ((*fp->f_ops->fo_poll)(fp, flag[msk], p)) {
FD_SET(fd, pobits);
n++;
}
@@ -802,13 +802,13 @@ selscan(p, ibits, obits, nfd, retval)
/*ARGSUSED*/
int
-seltrue(dev, flag, p)
+seltrue(dev, events, p)
dev_t dev;
- int flag;
+ int events;
struct proc *p;
{
- return (1);
+ return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
}
/*
@@ -871,39 +871,25 @@ pollscan(p, pl, nfd, retval)
int nfd;
register_t *retval;
{
- register struct filedesc *fdp = p->p_fd;
- register int msk, i;
+ struct filedesc *fdp = p->p_fd;
struct file *fp;
- int x, n = 0;
- static int flag[3] = { FREAD, FWRITE, 0 };
- static int pflag[3] = { POLLIN|POLLRDNORM, POLLOUT, POLLERR };
+ int i, n = 0;
- /*
- * XXX: We need to implement the rest of the flags.
- */
- for (i = 0; i < nfd; i++) {
+ for (i = 0; i < nfd; i++, pl++) {
/* Check the file descriptor. */
- if (pl[i].fd < 0) {
- pl[i].revents = 0;
+ if (pl->fd < 0) {
+ pl->revents = 0;
continue;
}
- if ((fp = fd_getfile(fdp, pl[i].fd)) == NULL) {
- pl[i].revents = POLLNVAL;
+ if ((fp = fd_getfile(fdp, pl->fd)) == NULL) {
+ pl->revents = POLLNVAL;
n++;
continue;
}
FREF(fp);
- for (x = msk = 0; msk < 3; msk++) {
- if (pl[i].events & pflag[msk]) {
- if ((*fp->f_ops->fo_select)(fp, flag[msk], p)) {
- pl[i].revents |= pflag[msk] &
- pl[i].events;
- x++;
- }
- }
- }
+ pl->revents = (*fp->f_ops->fo_poll)(fp, pl->events, p);
FRELE(fp);
- if (x)
+ if (pl->revents != 0)
n++;
}
*retval = n;
@@ -921,7 +907,7 @@ sys_poll(struct proc *p, void *v, register_t *retval)
struct pollfd pfds[4], *pl = pfds;
int msec = SCARG(uap, timeout);
struct timeval atv;
- int timo, ncoll, i, s, error, error2;
+ int timo, ncoll, i, s, error;
extern int nselcoll, selwait;
u_int nfds;
@@ -946,7 +932,7 @@ sys_poll(struct proc *p, void *v, register_t *retval)
for (i = 0; i < nfds; i++)
pl[i].revents = 0;
- if (msec != -1) {
+ if (msec != INFTIM) {
atv.tv_sec = msec / 1000;
atv.tv_usec = (msec - (atv.tv_sec * 1000)) * 1000;
@@ -966,7 +952,7 @@ retry:
pollscan(p, pl, nfds, retval);
if (*retval)
goto done;
- if (msec != -1) {
+ if (msec != INFTIM) {
/*
* We have to recalculate the timeout on every retry.
*/
@@ -987,16 +973,21 @@ retry:
done:
p->p_flag &= ~P_SELECT;
- /* poll is not restarted after signals... */
- if (error == ERESTART)
+ /*
+ * NOTE: poll(2) is not restarted after a signal and EWOULDBLOCK is
+ * ignored (since the whole point is to see what would block).
+ */
+ switch (error) {
+ case ERESTART:
error = EINTR;
- if (error == EWOULDBLOCK)
- error = 0;
- if ((error2 = copyout(pl, SCARG(uap, fds), sz)) != 0)
- error = error2;
+ break;
+ case EWOULDBLOCK:
+ case 0:
+ error = copyout(pl, SCARG(uap, fds), sz);
+ break;
+ }
bad:
if (pl != pfds)
- free((char *) pl, M_TEMP);
+ free(pl, M_TEMP);
return (error);
}
-
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index ac7416eb1df..3e36d581fd4 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_pipe.c,v 1.43 2002/03/14 01:27:04 millert Exp $ */
+/* $OpenBSD: sys_pipe.c,v 1.44 2003/09/23 16:51:12 millert Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@@ -46,6 +46,7 @@
#include <sys/syscallargs.h>
#include <sys/event.h>
#include <sys/lock.h>
+#include <sys/poll.h>
#include <uvm/uvm_extern.h>
@@ -57,13 +58,13 @@
int pipe_read(struct file *, off_t *, struct uio *, struct ucred *);
int pipe_write(struct file *, off_t *, struct uio *, struct ucred *);
int pipe_close(struct file *, struct proc *);
-int pipe_select(struct file *, int which, struct proc *);
+int pipe_poll(struct file *, int events, struct proc *);
int pipe_kqfilter(struct file *fp, struct knote *kn);
int pipe_ioctl(struct file *, u_long, caddr_t, struct proc *);
int pipe_stat(struct file *fp, struct stat *ub, struct proc *p);
static struct fileops pipeops = {
- pipe_read, pipe_write, pipe_ioctl, pipe_select, pipe_kqfilter,
+ pipe_read, pipe_write, pipe_ioctl, pipe_poll, pipe_kqfilter,
pipe_stat, pipe_close
};
@@ -540,7 +541,7 @@ retrywrite:
/*
* We have no more space and have something to offer,
- * wake up selects.
+ * wake up select/poll.
*/
pipeselwakeup(wpipe);
@@ -587,8 +588,7 @@ retrywrite:
if (error == 0)
microtime(&wpipe->pipe_mtime);
/*
- * We have something to offer,
- * wake up select.
+ * We have something to offer, wake up select/poll.
*/
if (wpipe->pipe_buffer.cnt)
pipeselwakeup(wpipe);
@@ -638,48 +638,43 @@ pipe_ioctl(fp, cmd, data, p)
}
int
-pipe_select(fp, which, p)
+pipe_poll(fp, events, p)
struct file *fp;
- int which;
+ int events;
struct proc *p;
{
struct pipe *rpipe = (struct pipe *)fp->f_data;
struct pipe *wpipe;
+ int revents = 0;
wpipe = rpipe->pipe_peer;
- switch (which) {
-
- case FREAD:
+ if (events & (POLLIN | POLLRDNORM)) {
if ((rpipe->pipe_buffer.cnt > 0) ||
- (rpipe->pipe_state & PIPE_EOF)) {
- return (1);
- }
- selrecord(p, &rpipe->pipe_sel);
- rpipe->pipe_state |= PIPE_SEL;
- break;
+ (rpipe->pipe_state & PIPE_EOF))
+ revents |= events & (POLLIN | POLLRDNORM);
+ }
- case FWRITE:
- if ((wpipe == NULL) ||
- (wpipe->pipe_state & PIPE_EOF) ||
- ((wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) >= PIPE_BUF)) {
- return (1);
- }
- selrecord(p, &wpipe->pipe_sel);
- wpipe->pipe_state |= PIPE_SEL;
- break;
+ /* NOTE: POLLHUP and POLLOUT/POLLWRNORM are mutually exclusive */
+ if ((rpipe->pipe_state & PIPE_EOF) ||
+ (wpipe == NULL) ||
+ (wpipe->pipe_state & PIPE_EOF))
+ revents |= POLLHUP;
+ else if (events & (POLLOUT | POLLWRNORM)) {
+ if ((wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) >= PIPE_BUF)
+ revents |= events & (POLLOUT | POLLWRNORM);
+ }
- case 0:
- if ((rpipe->pipe_state & PIPE_EOF) ||
- (wpipe == NULL) ||
- (wpipe->pipe_state & PIPE_EOF)) {
- return (1);
+ if (revents == 0) {
+ if (events & (POLLIN | POLLRDNORM)) {
+ selrecord(p, &rpipe->pipe_sel);
+ rpipe->pipe_state |= PIPE_SEL;
+ }
+ if (events & (POLLOUT | POLLWRNORM)) {
+ selrecord(p, &wpipe->pipe_sel);
+ wpipe->pipe_state |= PIPE_SEL;
}
-
- selrecord(p, &rpipe->pipe_sel);
- rpipe->pipe_state |= PIPE_SEL;
- break;
}
- return (0);
+ return (revents);
}
int
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
index 3f598f425fe..4c367c31de7 100644
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_socket.c,v 1.8 2003/06/02 23:28:06 millert Exp $ */
+/* $OpenBSD: sys_socket.c,v 1.9 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */
/*
@@ -41,13 +41,14 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/ioctl.h>
+#include <sys/poll.h>
#include <sys/stat.h>
#include <net/if.h>
#include <net/route.h>
struct fileops socketops = {
- soo_read, soo_write, soo_ioctl, soo_select, soo_kqfilter,
+ soo_read, soo_write, soo_ioctl, soo_poll, soo_kqfilter,
soo_stat, soo_close
};
@@ -139,45 +140,39 @@ soo_ioctl(fp, cmd, data, p)
}
int
-soo_select(fp, which, p)
+soo_poll(fp, events, p)
struct file *fp;
- int which;
+ int events;
struct proc *p;
{
- register struct socket *so = (struct socket *)fp->f_data;
- register int s = splsoftnet();
-
- switch (which) {
+ struct socket *so = (struct socket *)fp->f_data;
+ int revents = 0;
+ int s = splsoftnet();
- case FREAD:
- if (soreadable(so)) {
- splx(s);
- return (1);
- }
- selrecord(p, &so->so_rcv.sb_sel);
- so->so_rcv.sb_flags |= SB_SEL;
- break;
-
- case FWRITE:
- if (sowriteable(so)) {
- splx(s);
- return (1);
+ if (events & (POLLIN | POLLRDNORM)) {
+ if (soreadable(so))
+ revents |= events & (POLLIN | POLLRDNORM);
+ }
+ if (events & (POLLOUT | POLLWRNORM)) {
+ if (sowriteable(so))
+ revents |= events & (POLLOUT | POLLWRNORM);
+ }
+ if (events & (POLLPRI | POLLRDBAND)) {
+ if (so->so_oobmark || (so->so_state & SS_RCVATMARK))
+ revents |= events & (POLLPRI | POLLRDBAND);
+ }
+ if (revents == 0) {
+ if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) {
+ selrecord(p, &so->so_rcv.sb_sel);
+ so->so_rcv.sb_flags |= SB_SEL;
}
- selrecord(p, &so->so_snd.sb_sel);
- so->so_snd.sb_flags |= SB_SEL;
- break;
-
- case 0:
- if (so->so_oobmark || (so->so_state & SS_RCVATMARK)) {
- splx(s);
- return (1);
+ if (events & (POLLOUT | POLLWRNORM)) {
+ selrecord(p, &so->so_snd.sb_sel);
+ so->so_snd.sb_flags |= SB_SEL;
}
- selrecord(p, &so->so_rcv.sb_sel);
- so->so_rcv.sb_flags |= SB_SEL;
- break;
}
splx(s);
- return (0);
+ return (revents);
}
int
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 924b686d74a..1a86d45a0d6 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.60 2003/08/23 19:21:15 deraadt Exp $ */
+/* $OpenBSD: tty.c,v 1.61 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
@@ -56,6 +56,7 @@
#include <sys/resourcevar.h>
#include <sys/sysctl.h>
#include <sys/pool.h>
+#include <sys/poll.h>
#include <sys/namei.h>
@@ -1026,35 +1027,35 @@ ttioctl(tp, cmd, data, flag, p)
}
int
-ttselect(device, rw, p)
+ttpoll(device, events, p)
dev_t device;
- int rw;
+ int events;
struct proc *p;
{
- register struct tty *tp;
- int nread, s;
+ struct tty *tp;
+ int revents, s;
tp = (*cdevsw[major(device)].d_tty)(device);
+ revents = 0;
s = spltty();
- switch (rw) {
- case FREAD:
- nread = ttnread(tp);
- if (nread > 0 || (!ISSET(tp->t_cflag, CLOCAL) &&
- !ISSET(tp->t_state, TS_CARR_ON)))
- goto win;
- selrecord(p, &tp->t_rsel);
- break;
- case FWRITE:
- if (tp->t_outq.c_cc <= tp->t_lowat) {
-win: splx(s);
- return (1);
- }
- selrecord(p, &tp->t_wsel);
- break;
+ if (events & (POLLIN | POLLRDNORM)) {
+ if (ttnread(tp) > 0 || (!ISSET(tp->t_cflag, CLOCAL) &&
+ !ISSET(tp->t_state, TS_CARR_ON)))
+ revents |= events & (POLLIN | POLLRDNORM);
+ }
+ if (events & (POLLOUT | POLLWRNORM)) {
+ if (tp->t_outq.c_cc <= tp->t_lowat)
+ revents |= events & (POLLOUT | POLLWRNORM);
+ }
+ if (revents == 0) {
+ if (events & (POLLIN | POLLRDNORM))
+ selrecord(p, &tp->t_rsel);
+ if (events & (POLLOUT | POLLWRNORM))
+ selrecord(p, &tp->t_wsel);
}
splx(s);
- return (0);
+ return (revents);
}
struct filterops ttyread_filtops =
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index 7cbb13a523a..6cb8615f724 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_pty.c,v 1.14 2003/07/22 01:03:12 mickey Exp $ */
+/* $OpenBSD: tty_pty.c,v 1.15 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */
/*
@@ -50,6 +50,7 @@
#include <sys/signalvar.h>
#include <sys/uio.h>
#include <sys/conf.h>
+#include <sys/poll.h>
#define BUFSIZ 100 /* Chunk size iomoved to/from user */
@@ -233,7 +234,7 @@ ptswrite(dev, uio, flag)
/*
* Start output on pseudo-tty.
- * Wake up process selecting or sleeping for input from controlling tty.
+ * Wake up process polling or sleeping for input from controlling tty.
*/
void
ptsstart(tp)
@@ -501,58 +502,52 @@ block:
}
int
-ptcselect(dev, rw, p)
- dev_t dev;
- int rw;
- struct proc *p;
+ptcpoll(dev_t dev, int events, struct proc *p)
{
- register struct pt_softc *pti = &pt_softc[minor(dev)];
- register struct tty *tp = pti->pt_tty;
- int s;
+ struct pt_softc *pti = &pt_softc[minor(dev)];
+ struct tty *tp = pti->pt_tty;
+ int revents = 0, s;
- if ((tp->t_state&TS_CARR_ON) == 0)
- return (1);
- switch (rw) {
+ if (!ISSET(tp->t_state, TS_CARR_ON))
+ return (POLLHUP);
+
+ if (!ISSET(tp->t_state, TS_ISOPEN))
+ goto notopen;
- case FREAD:
+ if (events & (POLLIN | POLLRDNORM)) {
/*
- * Need to block timeouts (ttrstart).
+ * Need to protect access to t_outq
*/
s = spltty();
- if ((tp->t_state&TS_ISOPEN) &&
- tp->t_outq.c_cc && (tp->t_state&TS_TTSTOP) == 0) {
- splx(s);
- return (1);
- }
+ if ((tp->t_outq.c_cc && !ISSET(tp->t_state, TS_TTSTOP)) ||
+ ((pti->pt_flags & PF_PKT) && pti->pt_send) ||
+ ((pti->pt_flags & PF_UCNTL) && pti->pt_ucntl))
+ revents |= events & (POLLIN | POLLRDNORM);
splx(s);
- /* FALLTHROUGH */
-
- case 0: /* exceptional */
- if ((tp->t_state&TS_ISOPEN) &&
- (((pti->pt_flags & PF_PKT) && pti->pt_send) ||
- ((pti->pt_flags & PF_UCNTL) && pti->pt_ucntl)))
- return (1);
- selrecord(p, &pti->pt_selr);
- break;
-
-
- case FWRITE:
- if (tp->t_state&TS_ISOPEN) {
- if (pti->pt_flags & PF_REMOTE) {
- if (tp->t_canq.c_cc == 0)
- return (1);
- } else {
- if (tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG-2)
- return (1);
- if (tp->t_canq.c_cc == 0 && ISSET(tp->t_lflag, ICANON))
- return (1);
- }
- }
- selrecord(p, &pti->pt_selw);
- break;
+ }
+ if (events & (POLLOUT | POLLWRNORM)) {
+ if ((pti->pt_flags & PF_REMOTE) ?
+ (tp->t_canq.c_cc == 0) :
+ ((tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG - 2) ||
+ (tp->t_canq.c_cc == 0 && ISSET(tp->t_lflag, ICANON))))
+ revents |= events & (POLLOUT | POLLWRNORM);
+ }
+ if (events & (POLLPRI | POLLRDBAND)) {
+ /* If in packet or user control mode, check for data. */
+ if (((pti->pt_flags & PF_PKT) && pti->pt_send) ||
+ ((pti->pt_flags & PF_UCNTL) && pti->pt_ucntl))
+ revents |= events & (POLLPRI | POLLRDBAND);
+ }
+ if (revents == 0) {
+notopen:
+ if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND))
+ selrecord(p, &pti->pt_selr);
+ if (events & (POLLOUT | POLLWRNORM))
+ selrecord(p, &pti->pt_selw);
}
- return (0);
+
+ return (revents);
}
void
diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c
index 6c09bf4dbad..2c6ea90231b 100644
--- a/sys/kern/tty_tty.c
+++ b/sys/kern/tty_tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_tty.c,v 1.7 2003/06/02 23:28:06 millert Exp $ */
+/* $OpenBSD: tty_tty.c,v 1.8 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: tty_tty.c,v 1.13 1996/03/30 22:24:46 christos Exp $ */
/*-
@@ -143,14 +143,14 @@ cttyioctl(dev, cmd, addr, flag, p)
/*ARGSUSED*/
int
-cttyselect(dev, flag, p)
+cttypoll(dev, events, p)
dev_t dev;
- int flag;
+ int events;
struct proc *p;
{
struct vnode *ttyvp = cttyvp(p);
- if (ttyvp == NULL)
- return (1); /* try operation to get EOF/failure */
- return (VOP_SELECT(ttyvp, flag, FREAD|FWRITE, NOCRED, p));
+ if (ttyvp == NULL) /* try operation to get EOF/failure */
+ return (seltrue(dev, events, p));
+ return (VOP_POLL(ttyvp, events, p));
}
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 04354256017..bcef263c4a9 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_vnops.c,v 1.43 2003/07/21 22:44:50 tedu Exp $ */
+/* $OpenBSD: vfs_vnops.c,v 1.44 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */
/*
@@ -50,6 +50,7 @@
#include <sys/ioctl.h>
#include <sys/tty.h>
#include <sys/cdio.h>
+#include <sys/poll.h>
#include <uvm/uvm_extern.h>
@@ -57,14 +58,14 @@ int vn_read(struct file *fp, off_t *off, struct uio *uio,
struct ucred *cred);
int vn_write(struct file *fp, off_t *off, struct uio *uio,
struct ucred *cred);
-int vn_select(struct file *fp, int which, struct proc *p);
+int vn_poll(struct file *fp, int events, struct proc *p);
int vn_kqfilter(struct file *fp, struct knote *kn);
int vn_closefile(struct file *fp, struct proc *p);
int vn_ioctl(struct file *fp, u_long com, caddr_t data,
struct proc *p);
struct fileops vnops =
- { vn_read, vn_write, vn_ioctl, vn_select, vn_kqfilter, vn_statfile,
+ { vn_read, vn_write, vn_ioctl, vn_poll, vn_kqfilter, vn_statfile,
vn_closefile };
/*
@@ -467,17 +468,16 @@ vn_ioctl(fp, com, data, p)
}
/*
- * File table vnode select routine.
+ * File table vnode poll routine.
*/
int
-vn_select(fp, which, p)
+vn_poll(fp, events, p)
struct file *fp;
- int which;
+ int events;
struct proc *p;
{
- return (VOP_SELECT(((struct vnode *)fp->f_data), which, fp->f_flag,
- fp->f_cred, p));
+ return (VOP_POLL(((struct vnode *)fp->f_data), events, p));
}
/*
diff --git a/sys/miscfs/deadfs/dead_vnops.c b/sys/miscfs/deadfs/dead_vnops.c
index cbfb7b817f7..b91827115bc 100644
--- a/sys/miscfs/deadfs/dead_vnops.c
+++ b/sys/miscfs/deadfs/dead_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dead_vnops.c,v 1.14 2003/06/02 23:28:10 millert Exp $ */
+/* $OpenBSD: dead_vnops.c,v 1.15 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: dead_vnops.c,v 1.16 1996/02/13 13:12:48 mycroft Exp $ */
/*
@@ -40,6 +40,7 @@
#include <sys/namei.h>
#include <sys/buf.h>
#include <sys/proc.h>
+#include <sys/poll.h>
/*
* Prototypes for dead operations on vnodes.
@@ -58,7 +59,7 @@ int dead_open(void *);
int dead_read(void *);
int dead_write(void *);
int dead_ioctl(void *);
-int dead_select(void *);
+int dead_poll(void *);
#define dead_fsync nullop
#define dead_remove dead_badop
#define dead_link dead_badop
@@ -98,7 +99,7 @@ struct vnodeopv_entry_desc dead_vnodeop_entries[] = {
{ &vop_read_desc, dead_read }, /* read */
{ &vop_write_desc, dead_write }, /* write */
{ &vop_ioctl_desc, dead_ioctl }, /* ioctl */
- { &vop_select_desc, dead_select }, /* select */
+ { &vop_poll_desc, dead_poll }, /* poll */
{ &vop_fsync_desc, dead_fsync }, /* fsync */
{ &vop_remove_desc, dead_remove }, /* remove */
{ &vop_link_desc, dead_link }, /* link */
@@ -224,13 +225,21 @@ dead_ioctl(v)
/* ARGSUSED */
int
-dead_select(v)
+dead_poll(v)
void *v;
{
+#if 0
+ struct vop_poll_args /* {
+ struct vnode *a_vp;
+ int a_events;
+ struct proc *a_p;
+ } */ *ap = v;
+#endif
+
/*
* Let the user find out that the descriptor is gone.
*/
- return (1);
+ return (POLLHUP);
}
/*
diff --git a/sys/miscfs/fdesc/fdesc_vnops.c b/sys/miscfs/fdesc/fdesc_vnops.c
index beaf194076d..62fc74c0a83 100644
--- a/sys/miscfs/fdesc/fdesc_vnops.c
+++ b/sys/miscfs/fdesc/fdesc_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdesc_vnops.c,v 1.35 2003/06/02 23:28:10 millert Exp $ */
+/* $OpenBSD: fdesc_vnops.c,v 1.36 2003/09/23 16:51:12 millert Exp $ */
/* $NetBSD: fdesc_vnops.c,v 1.32 1996/04/11 11:24:29 mrg Exp $ */
/*
@@ -60,6 +60,7 @@
#include <sys/buf.h>
#include <sys/dirent.h>
#include <sys/tty.h>
+#include <sys/poll.h>
#include <miscfs/fdesc/fdesc.h>
@@ -97,7 +98,7 @@ int fdesc_setattr(void *);
int fdesc_read(void *);
int fdesc_write(void *);
int fdesc_ioctl(void *);
-int fdesc_select(void *);
+int fdesc_poll(void *);
#define fdesc_fsync nullop
#define fdesc_remove eopnotsupp
#define fdesc_revoke vop_generic_revoke
@@ -135,7 +136,7 @@ struct vnodeopv_entry_desc fdesc_vnodeop_entries[] = {
{ &vop_write_desc, fdesc_write }, /* write */
{ &vop_ioctl_desc, fdesc_ioctl }, /* ioctl */
{ &vop_revoke_desc, fdesc_revoke }, /* revoke */
- { &vop_select_desc, fdesc_select }, /* select */
+ { &vop_poll_desc, fdesc_poll }, /* poll */
{ &vop_fsync_desc, fdesc_fsync }, /* fsync */
{ &vop_remove_desc, fdesc_remove }, /* remove */
{ &vop_link_desc, fdesc_link }, /* link */
@@ -825,29 +826,27 @@ fdesc_ioctl(v)
}
int
-fdesc_select(v)
+fdesc_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;
- int error = EOPNOTSUPP;
+ int revents;
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
- error = cttyselect(devctty, ap->a_fflags, ap->a_p);
+ revents = cttypoll(devctty, ap->a_events, ap->a_p);
break;
default:
- error = EOPNOTSUPP;
+ revents = ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM);
break;
}
- return (error);
+ return (revents);
}
int
diff --git a/sys/miscfs/fifofs/fifo.h b/sys/miscfs/fifofs/fifo.h
index 5dbaf84066a..9fc76eb5a00 100644
--- a/sys/miscfs/fifofs/fifo.h
+++ b/sys/miscfs/fifofs/fifo.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fifo.h,v 1.13 2003/06/02 23:28:10 millert Exp $ */
+/* $OpenBSD: fifo.h,v 1.14 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: fifo.h,v 1.10 1996/02/09 22:40:15 christos Exp $ */
/*
@@ -51,7 +51,7 @@ int fifo_read(void *);
int fifo_write(void *);
#define fifo_lease_check nullop
int fifo_ioctl(void *);
-int fifo_select(void *);
+int fifo_poll(void *);
int fifo_kqfilter(void *);
#define fifo_fsync nullop
#define fifo_remove fifo_badop
diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c
index 316699e7a42..71a606bec48 100644
--- a/sys/miscfs/fifofs/fifo_vnops.c
+++ b/sys/miscfs/fifofs/fifo_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fifo_vnops.c,v 1.15 2003/06/02 23:28:10 millert Exp $ */
+/* $OpenBSD: fifo_vnops.c,v 1.16 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */
/*
@@ -46,6 +46,7 @@
#include <sys/event.h>
#include <sys/errno.h>
#include <sys/malloc.h>
+#include <sys/poll.h>
#include <sys/un.h>
#include <miscfs/fifofs/fifo.h>
@@ -75,7 +76,7 @@ struct vnodeopv_entry_desc fifo_vnodeop_entries[] = {
{ &vop_write_desc, fifo_write }, /* write */
{ &vop_lease_desc, fifo_lease_check }, /* lease */
{ &vop_ioctl_desc, fifo_ioctl }, /* ioctl */
- { &vop_select_desc, fifo_select }, /* select */
+ { &vop_poll_desc, fifo_poll }, /* poll */
{ &vop_kqfilter_desc, fifo_kqfilter }, /* kqfilter */
{ &vop_revoke_desc, fifo_revoke }, /* revoke */
{ &vop_fsync_desc, fifo_fsync }, /* fsync */
@@ -353,31 +354,28 @@ fifo_ioctl(v)
/* ARGSUSED */
int
-fifo_select(v)
+fifo_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;
struct file filetmp;
- int ready;
+ int revents = 0;
- if (ap->a_fflags & FREAD) {
+ if (ap->a_events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) {
filetmp.f_data = (caddr_t)ap->a_vp->v_fifoinfo->fi_readsock;
- ready = soo_select(&filetmp, ap->a_which, ap->a_p);
- if (ready)
- return (ready);
- } else if (ap->a_fflags & FWRITE) {
+ if (filetmp.f_data)
+ revents |= soo_poll(&filetmp, ap->a_events, ap->a_p);
+ }
+ if (ap->a_events & (POLLOUT | POLLWRNORM | POLLWRBAND)) {
filetmp.f_data = (caddr_t)ap->a_vp->v_fifoinfo->fi_writesock;
- ready = soo_select(&filetmp, ap->a_which, ap->a_p);
- if (ready)
- return (ready);
+ if (filetmp.f_data)
+ revents |= soo_poll(&filetmp, ap->a_events, ap->a_p);
}
- return (0);
+ return (revents);
}
int
diff --git a/sys/miscfs/kernfs/kernfs.h b/sys/miscfs/kernfs/kernfs.h
index 4083055821a..8feda932cdb 100644
--- a/sys/miscfs/kernfs/kernfs.h
+++ b/sys/miscfs/kernfs/kernfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: kernfs.h,v 1.13 2003/08/14 07:46:39 mickey Exp $ */
+/* $OpenBSD: kernfs.h,v 1.14 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: kernfs.h,v 1.10 1996/02/09 22:40:21 christos Exp $ */
/*
@@ -94,6 +94,7 @@ struct kernfs_node {
int *, struct ucred **))eopnotsupp)
int kernfs_init(struct vfsconf *);
+int kernfs_poll(void *);
int kernfs_allocvp(const struct kern_target *, struct mount *, struct vnode **);
const struct kern_target *kernfs_findtarget(char *, int);
extern int (**kernfs_vnodeop_p)(void *);
diff --git a/sys/miscfs/kernfs/kernfs_vnops.c b/sys/miscfs/kernfs/kernfs_vnops.c
index 26b2bd535f5..c6b834fd24e 100644
--- a/sys/miscfs/kernfs/kernfs_vnops.c
+++ b/sys/miscfs/kernfs/kernfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kernfs_vnops.c,v 1.34 2003/08/11 10:19:24 mickey Exp $ */
+/* $OpenBSD: kernfs_vnops.c,v 1.35 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: kernfs_vnops.c,v 1.43 1996/03/16 23:52:47 christos Exp $ */
/*
@@ -54,6 +54,7 @@
#include <sys/buf.h>
#include <sys/dirent.h>
#include <sys/msgbuf.h>
+#include <sys/poll.h>
#include <miscfs/kernfs/kernfs.h>
#include <uvm/uvm_extern.h>
@@ -126,7 +127,6 @@ int kernfs_setattr(void *);
int kernfs_read(void *);
int kernfs_write(void *);
#define kernfs_ioctl (int (*)(void *))enoioctl
-#define kernfs_select eopnotsupp
#define kernfs_mmap eopnotsupp
#define kernfs_fsync nullop
#define kernfs_seek nullop
@@ -174,7 +174,7 @@ struct vnodeopv_entry_desc kernfs_vnodeop_entries[] = {
{ &vop_read_desc, kernfs_read }, /* read */
{ &vop_write_desc, kernfs_write }, /* write */
{ &vop_ioctl_desc, kernfs_ioctl }, /* ioctl */
- { &vop_select_desc, kernfs_select }, /* select */
+ { &vop_poll_desc, kernfs_poll }, /* poll */
{ &vop_revoke_desc, kernfs_revoke }, /* revoke */
{ &vop_fsync_desc, kernfs_fsync }, /* fsync */
{ &vop_remove_desc, kernfs_remove }, /* remove */
@@ -948,3 +948,16 @@ kernfs_badop(v)
panic("kernfs: bad op");
return 0;
}
+
+int
+kernfs_poll(v)
+ void *v;
+{
+ struct vop_poll_args /* {
+ struct vnode *a_vp;
+ int a_events;
+ struct proc *a_p;
+ } */ *ap = v;
+
+ return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
+}
diff --git a/sys/miscfs/portal/portal_vnops.c b/sys/miscfs/portal/portal_vnops.c
index 68df6606c54..de608b33825 100644
--- a/sys/miscfs/portal/portal_vnops.c
+++ b/sys/miscfs/portal/portal_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: portal_vnops.c,v 1.15 2003/06/02 23:28:10 millert Exp $ */
+/* $OpenBSD: portal_vnops.c,v 1.16 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: portal_vnops.c,v 1.17 1996/02/13 13:12:57 mycroft Exp $ */
/*
@@ -54,6 +54,7 @@
#include <sys/malloc.h>
#include <sys/namei.h>
#include <sys/mbuf.h>
+#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/un.h>
@@ -80,7 +81,6 @@ int portal_setattr(void *);
#define portal_read eopnotsupp
#define portal_write eopnotsupp
#define portal_ioctl (int (*)(void *))enoioctl
-#define portal_select eopnotsupp
#define portal_fsync nullop
#define portal_remove eopnotsupp
int portal_link(void *);
@@ -102,6 +102,7 @@ int portal_print(void *);
int portal_pathconf(void *);
#define portal_advlock eopnotsupp
#define portal_bwrite eopnotsupp
+int portal_poll(void *);
int (**portal_vnodeop_p)(void *);
struct vnodeopv_entry_desc portal_vnodeop_entries[] = {
@@ -117,7 +118,7 @@ struct vnodeopv_entry_desc portal_vnodeop_entries[] = {
{ &vop_read_desc, portal_read }, /* read */
{ &vop_write_desc, portal_write }, /* write */
{ &vop_ioctl_desc, portal_ioctl }, /* ioctl */
- { &vop_select_desc, portal_select }, /* select */
+ { &vop_poll_desc, portal_poll }, /* poll */
{ &vop_revoke_desc, portal_revoke }, /* revoke */
{ &vop_fsync_desc, portal_fsync }, /* fsync */
{ &vop_remove_desc, portal_remove }, /* remove */
@@ -719,3 +720,16 @@ portal_badop(v)
panic ("portal: bad op");
return (0);
}
+
+int
+portal_poll(v)
+ void *v;
+{
+ struct vop_poll_args /* {
+ struct vnode *a_vp;
+ int a_events;
+ struct proc *a_p;
+ } */ *ap = v;
+
+ return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
+}
diff --git a/sys/miscfs/procfs/procfs.h b/sys/miscfs/procfs/procfs.h
index c590f949c76..ced28816398 100644
--- a/sys/miscfs/procfs/procfs.h
+++ b/sys/miscfs/procfs/procfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: procfs.h,v 1.21 2003/08/14 07:46:40 mickey Exp $ */
+/* $OpenBSD: procfs.h,v 1.22 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: procfs.h,v 1.17 1996/02/12 15:01:41 christos Exp $ */
/*
@@ -124,6 +124,7 @@ int procfs_docpuinfo(struct proc *, struct proc *, struct pfsnode *pfsp, struct
int procfs_domap(struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio, int);
int procfs_freevp(struct vnode *);
int procfs_getcpuinfstr(char *, int *);
+int procfs_poll(void *);
/* functions to check whether or not files should be displayed */
int procfs_validfile(struct proc *, struct mount *);
diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c
index 82fb17f7aa6..40da1bc0c2f 100644
--- a/sys/miscfs/procfs/procfs_vnops.c
+++ b/sys/miscfs/procfs/procfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procfs_vnops.c,v 1.29 2003/06/02 23:28:11 millert Exp $ */
+/* $OpenBSD: procfs_vnops.c,v 1.30 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: procfs_vnops.c,v 1.40 1996/03/16 23:52:55 christos Exp $ */
/*
@@ -52,6 +52,7 @@
#include <sys/malloc.h>
#include <sys/dirent.h>
#include <sys/resourcevar.h>
+#include <sys/poll.h>
#include <sys/ptrace.h>
#include <sys/stat.h>
@@ -131,7 +132,6 @@ int procfs_setattr(void *);
#define procfs_read procfs_rw
#define procfs_write procfs_rw
int procfs_ioctl(void *);
-#define procfs_select procfs_badop
#define procfs_fsync procfs_badop
#define procfs_remove procfs_badop
int procfs_link(void *);
@@ -171,7 +171,7 @@ struct vnodeopv_entry_desc procfs_vnodeop_entries[] = {
{ &vop_read_desc, procfs_read }, /* read */
{ &vop_write_desc, procfs_write }, /* write */
{ &vop_ioctl_desc, procfs_ioctl }, /* ioctl */
- { &vop_select_desc, procfs_select }, /* select */
+ { &vop_poll_desc, procfs_poll }, /* poll */
{ &vop_fsync_desc, procfs_fsync }, /* fsync */
{ &vop_remove_desc, procfs_remove }, /* remove */
{ &vop_link_desc, procfs_link }, /* link */
@@ -1122,3 +1122,15 @@ atopid(b, len)
return (p);
}
+int
+procfs_poll(v)
+ void *v;
+{
+ struct vop_poll_args /* {
+ struct vnode *a_vp;
+ int a_events;
+ struct proc *a_p;
+ } */ *ap = v;
+
+ return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
+}
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
diff --git a/sys/miscfs/union/union_vnops.c b/sys/miscfs/union/union_vnops.c
index f8968541bd2..7a6dcc2c37b 100644
--- a/sys/miscfs/union/union_vnops.c
+++ b/sys/miscfs/union/union_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: union_vnops.c,v 1.21 2003/06/02 23:28:11 millert Exp $ */
+/* $OpenBSD: union_vnops.c,v 1.22 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: union_vnops.c,v 1.59 2002/09/27 15:37:48 provos Exp $ */
/*
@@ -70,7 +70,7 @@ int union_read(void *);
int union_write(void *);
int union_lease(void *);
int union_ioctl(void *);
-int union_select(void *);
+int union_poll(void *);
int union_fsync(void *);
int union_remove(void *);
int union_link(void *);
@@ -117,7 +117,7 @@ struct vnodeopv_entry_desc union_vnodeop_entries[] = {
{ &vop_write_desc, union_write }, /* write */
{ &vop_lease_desc, union_lease }, /* lease */
{ &vop_ioctl_desc, union_ioctl }, /* ioctl */
- { &vop_select_desc, union_select }, /* select */
+ { &vop_poll_desc, union_poll }, /* poll */
{ &vop_fsync_desc, union_fsync }, /* fsync */
{ &vop_remove_desc, union_remove }, /* remove */
{ &vop_link_desc, union_link }, /* link */
@@ -1073,20 +1073,18 @@ union_ioctl(v)
}
int
-union_select(v)
+union_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 struct vnode *vp = OTHERVP(ap->a_vp);
ap->a_vp = vp;
- return (VCALL(vp, VOFFSET(vop_select), ap));
+ return (VCALL(vp, VOFFSET(vop_poll), ap));
}
int
diff --git a/sys/msdosfs/denode.h b/sys/msdosfs/denode.h
index fea3d34467c..5f5b68c62df 100644
--- a/sys/msdosfs/denode.h
+++ b/sys/msdosfs/denode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: denode.h,v 1.14 2003/08/14 21:26:10 tedu Exp $ */
+/* $OpenBSD: denode.h,v 1.15 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: denode.h,v 1.24 1997/10/17 11:23:39 ws Exp $ */
/*-
@@ -272,7 +272,7 @@ int lease_check(void *);
#define msdosfs_lease_check nullop
#endif
int msdosfs_ioctl(void *);
-int msdosfs_select(void *);
+int msdosfs_poll(void *);
int msdosfs_fsync(void *);
int msdosfs_remove(void *);
int msdosfs_link(void *);
diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c
index f1408bec51b..8ccf6dc1b6a 100644
--- a/sys/msdosfs/msdosfs_vnops.c
+++ b/sys/msdosfs/msdosfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_vnops.c,v 1.41 2003/08/15 20:32:19 tedu Exp $ */
+/* $OpenBSD: msdosfs_vnops.c,v 1.42 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */
/*-
@@ -64,6 +64,7 @@
#include <sys/malloc.h>
#include <sys/dirent.h> /* defines dirent structure */
#include <sys/lockf.h>
+#include <sys/poll.h>
#include <uvm/uvm_extern.h>
@@ -706,20 +707,16 @@ msdosfs_ioctl(v)
}
int
-msdosfs_select(v)
+msdosfs_poll(v)
void *v;
{
-#if 0
- 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;
-#endif
- return (1); /* DOS filesystems never block? */
+ return (seltrue(ap->a_vp->v_rdev, ap->a_events, ap->a_p));
}
/*
@@ -1904,7 +1901,7 @@ struct vnodeopv_entry_desc msdosfs_vnodeop_entries[] = {
{ &vop_write_desc, msdosfs_write }, /* write */
{ &vop_lease_desc, msdosfs_lease_check }, /* lease */
{ &vop_ioctl_desc, msdosfs_ioctl }, /* ioctl */
- { &vop_select_desc, msdosfs_select }, /* select */
+ { &vop_poll_desc, msdosfs_poll }, /* poll */
{ &vop_fsync_desc, msdosfs_fsync }, /* fsync */
{ &vop_remove_desc, msdosfs_remove }, /* remove */
{ &vop_link_desc, msdosfs_link }, /* link */
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index f2e09c84d78..7e42edc8e62 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.37 2003/07/29 23:02:52 itojun Exp $ */
+/* $OpenBSD: bpf.c,v 1.38 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
@@ -48,6 +48,7 @@
#include <sys/vnode.h>
#include <sys/file.h>
#include <sys/socket.h>
+#include <sys/poll.h>
#include <sys/kernel.h>
#include <net/if.h>
@@ -83,7 +84,7 @@ int bpf_movein(struct uio *, int, struct mbuf **, struct sockaddr *);
void bpf_attachd(struct bpf_d *, struct bpf_if *);
void bpf_detachd(struct bpf_d *);
int bpf_setif(struct bpf_d *, struct ifreq *);
-int bpfselect(dev_t, int, struct proc *);
+int bpfpoll(dev_t, int, struct proc *);
int bpfkqfilter(dev_t, struct knote *);
static __inline void bpf_wakeup(struct bpf_d *);
void bpf_catchpacket(struct bpf_d *, u_char *, size_t, size_t,
@@ -928,46 +929,37 @@ bpf_ifname(ifp, ifr)
}
/*
- * Support for select() system call
- *
- * Return true iff the specific operation will not block indefinitely.
- * Otherwise, return false but make a note that a selwakeup() must be done.
+ * Support for poll() system call
*/
int
-bpfselect(dev, rw, p)
+bpfpoll(dev, events, p)
register dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
register struct bpf_d *d;
- register int s;
+ register int s, revents;
+
+ revents = events & (POLLIN | POLLRDNORM);
+ if (revents == 0)
+ return (0); /* only support reading */
- if (rw != FREAD)
- return (0);
/*
* An imitation of the FIONREAD ioctl code.
*/
d = &bpf_dtab[minor(dev)];
-
s = splimp();
- if (d->bd_hlen != 0 || (d->bd_immediate && d->bd_slen != 0)) {
+ if (d->bd_hlen == 0 && (!d->bd_immediate || d->bd_slen == 0)) {
+ revents = 0; /* no data waiting */
/*
- * There is data waiting.
+ * if there's a timeout, mark the time we started waiting.
*/
- splx(s);
- return (1);
+ if (d->bd_rtout != -1 && d->bd_rdStart == 0)
+ d->bd_rdStart = ticks;
+ selrecord(p, &d->bd_sel);
}
-
- /*
- * if there isn't data waiting, and there's a timeout,
- * mark the time we started waiting.
- */
- if (d->bd_rtout != -1 && d->bd_rdStart == 0)
- d->bd_rdStart = ticks;
-
- selrecord(p, &d->bd_sel);
splx(s);
- return (0);
+ return (revents);
}
struct filterops bpfread_filtops =
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 8bfe75e4182..5e8b3fe950a 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.49 2003/08/15 20:32:19 tedu Exp $ */
+/* $OpenBSD: if_tun.c,v 1.50 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -53,6 +53,7 @@
#include <sys/device.h>
#include <sys/vnode.h>
#include <sys/signalvar.h>
+#include <sys/poll.h>
#include <sys/conf.h>
#include <machine/cpu.h>
@@ -128,7 +129,7 @@ int tun_output(struct ifnet *, struct mbuf *, struct sockaddr *,
int tunioctl(dev_t, u_long, caddr_t, int, struct proc *);
int tunread(dev_t, struct uio *, int);
int tunwrite(dev_t, struct uio *, int);
-int tunselect(dev_t, int, struct proc *);
+int tunpoll(dev_t, int, struct proc *);
int tunkqfilter(dev_t, struct knote *);
@@ -742,12 +743,12 @@ tunwrite(dev, uio, ioflag)
* anyway, it either accepts the packet or drops it.
*/
int
-tunselect(dev, rw, p)
+tunpoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
- int unit, s;
+ int unit, revents, s;
struct tun_softc *tp;
struct ifnet *ifp;
struct mbuf *m;
@@ -757,27 +758,25 @@ tunselect(dev, rw, p)
tp = &tunctl[unit];
ifp = &tp->tun_if;
+ revents = 0;
s = splimp();
- TUNDEBUG(("%s: tunselect\n", ifp->if_xname));
+ TUNDEBUG(("%s: tunpoll\n", ifp->if_xname));
- switch (rw) {
- case FREAD:
+ if (events & (POLLIN | POLLRDNORM)) {
IFQ_POLL(&ifp->if_snd, m);
if (m != NULL) {
- splx(s);
TUNDEBUG(("%s: tunselect q=%d\n", ifp->if_xname,
ifp->if_snd.ifq_len));
- return 1;
+ revents |= events & (POLLIN | POLLRDNORM);
+ } else {
+ TUNDEBUG(("%s: tunpoll waiting\n", ifp->if_xname));
+ selrecord(p, &tp->tun_rsel);
}
- selrecord(curproc, &tp->tun_rsel);
- break;
- case FWRITE:
- splx(s);
- return 1;
}
+ if (events & (POLLOUT | POLLWRNORM))
+ revents |= events & (POLLOUT | POLLWRNORM);
splx(s);
- TUNDEBUG(("%s: tunselect waiting\n", ifp->if_xname));
- return 0;
+ return (revents);
}
/* Does not currently work */
diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c
index af96ee6df94..5e6c30d6f44 100644
--- a/sys/net/ppp_tty.c
+++ b/sys/net/ppp_tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ppp_tty.c,v 1.18 2003/09/18 19:32:20 tedu Exp $ */
+/* $OpenBSD: ppp_tty.c,v 1.19 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: ppp_tty.c,v 1.12 1997/03/24 21:23:10 christos Exp $ */
/*
@@ -706,7 +706,7 @@ pppasyncctlp(sc)
struct tty *tp;
int s;
- /* Put a placeholder byte in canq for ttselect()/ttnread(). */
+ /* Put a placeholder byte in canq for ttpoll()/ttnread(). */
s = spltty();
tp = (struct tty *) sc->sc_devp;
putc(0, &tp->t_canq);
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index 72620a49385..9a52e9b8a47 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vnops.c,v 1.55 2003/06/02 23:28:20 millert Exp $ */
+/* $OpenBSD: nfs_vnops.c,v 1.56 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */
/*
@@ -97,7 +97,7 @@ struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = {
{ &vop_write_desc, nfs_write }, /* write */
{ &vop_lease_desc, nfs_lease_check }, /* lease */
{ &vop_ioctl_desc, nfs_ioctl }, /* ioctl */
- { &vop_select_desc, nfs_select }, /* select */
+ { &vop_poll_desc, nfs_poll }, /* poll */
{ &vop_kqfilter_desc, vop_generic_kqfilter }, /* kqfilter */
{ &vop_revoke_desc, nfs_revoke }, /* revoke */
{ &vop_fsync_desc, nfs_fsync }, /* fsync */
diff --git a/sys/nfs/nfsnode.h b/sys/nfs/nfsnode.h
index 66c822bc595..453c62b3582 100644
--- a/sys/nfs/nfsnode.h
+++ b/sys/nfs/nfsnode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsnode.h,v 1.18 2003/06/02 23:28:20 millert Exp $ */
+/* $OpenBSD: nfsnode.h,v 1.19 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: nfsnode.h,v 1.16 1996/02/18 11:54:04 fvdl Exp $ */
/*
@@ -170,7 +170,7 @@ int nfsspec_write(void *);
int nfsfifo_read(void *);
int nfsfifo_write(void *);
#define nfs_ioctl ((int (*)(void *))enoioctl)
-#define nfs_select ((int (*)(void *))seltrue)
+#define nfs_poll ((int (*)(void *))seltrue)
#define nfs_revoke vop_generic_revoke
int nfs_fsync(void *);
int nfs_remove(void *);
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index e05d9753879..7e2530401ee 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.71 2003/06/27 16:57:14 nate Exp $ */
+/* $OpenBSD: conf.h,v 1.72 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: conf.h,v 1.33 1996/05/03 20:03:32 christos Exp $ */
/*-
@@ -152,7 +152,7 @@ struct cdevsw {
int (*d_stop)(struct tty *tp, int rw);
struct tty *
(*d_tty)(dev_t dev);
- int (*d_select)(dev_t dev, int which, struct proc *p);
+ int (*d_poll)(dev_t dev, int events, struct proc *p);
paddr_t (*d_mmap)(dev_t, off_t, int);
u_int d_type;
int (*d_kqfilter)(dev_t dev, struct knote *kn);
@@ -167,14 +167,14 @@ extern struct cdevsw cdevsw[];
#define dev_type_write(n) int n(dev_t, struct uio *, int)
#define dev_type_stop(n) int n(struct tty *, int)
#define dev_type_tty(n) struct tty *n(dev_t)
-#define dev_type_select(n) int n(dev_t, int, struct proc *)
+#define dev_type_poll(n) int n(dev_t, int, struct proc *)
#define dev_type_mmap(n) paddr_t n(dev_t, off_t, int)
#define dev_type_kqfilter(n) int n(dev_t, struct knote *)
#define cdev_decl(n) \
dev_decl(n,open); dev_decl(n,close); dev_decl(n,read); \
dev_decl(n,write); dev_decl(n,ioctl); dev_decl(n,stop); \
- dev_decl(n,tty); dev_decl(n,select); dev_decl(n,mmap); \
+ dev_decl(n,tty); dev_decl(n,poll); dev_decl(n,mmap); \
dev_decl(n,kqfilter)
/* open, close, read, write, ioctl */
@@ -200,21 +200,21 @@ extern struct cdevsw cdevsw[];
#define cdev_tty_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
- dev_init(c,n,tty), ttselect, (dev_type_mmap((*))) enodev, \
+ dev_init(c,n,tty), ttpoll, (dev_type_mmap((*))) enodev, \
D_TTY | D_KQFILTER, ttkqfilter }
-/* open, close, read, ioctl, select, nokqfilter */
+/* open, close, read, ioctl, poll, nokqfilter */
#define cdev_mouse_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
+ (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
(dev_type_mmap((*))) enodev }
-/* open, close, read, write, ioctl, select, nokqfilter */
+/* open, close, read, write, ioctl, poll, nokqfilter */
#define cdev_mousewr_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
+ (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
(dev_type_mmap((*))) enodev }
#define cdev_lkm_dummy() { \
@@ -229,18 +229,18 @@ extern struct cdevsw cdevsw[];
(dev_type_ioctl((*))) enodev, (dev_type_stop((*))) enodev, \
0, seltrue, (dev_type_mmap((*))) enodev }
-/* open, close, read, write, ioctl, select, kqfilter -- XXX should be a tty */
+/* open, close, read, write, ioctl, poll, kqfilter -- XXX should be a tty */
#define cdev_cn_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
- 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, \
+ 0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev, \
D_TTY | D_KQFILTER, dev_init(c,n,kqfilter) }
-/* open, read, write, ioctl, select, kqfilter -- XXX should be a tty */
+/* open, read, write, ioctl, poll, kqfilter -- XXX should be a tty */
#define cdev_ctty_init(c,n) { \
dev_init(c,n,open), (dev_type_close((*))) nullop, dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
- 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, \
+ 0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev, \
D_TTY | D_KQFILTER, ttkqfilter }
/* open, close, read, write, ioctl, mmap */
@@ -253,33 +253,33 @@ extern struct cdevsw cdevsw[];
#define cdev_crypto_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev }
+ 0, (dev_type_poll((*))) enodev, (dev_type_mmap((*))) enodev }
/* open, close, read, write, ioctl */
#define cdev_systrace_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev }
+ 0, (dev_type_poll((*))) enodev, (dev_type_mmap((*))) enodev }
/* read, write */
#define cdev_swap_init(c,n) { \
(dev_type_open((*))) nullop, (dev_type_close((*))) nullop, \
dev_init(c,n,read), dev_init(c,n,write), (dev_type_ioctl((*))) enodev, \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev }
-/* open, close, read, write, ioctl, tty, select, kqfilter */
+/* open, close, read, write, ioctl, tty, poll, kqfilter */
#define cdev_ptc_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
- dev_init(c,n,tty), dev_init(c,n,select), (dev_type_mmap((*))) enodev, \
+ dev_init(c,n,tty), dev_init(c,n,poll), (dev_type_mmap((*))) enodev, \
D_TTY | D_KQFILTER, dev_init(c,n,kqfilter) }
-/* open, close, read, ioctl, select, kqfilter -- XXX should be a generic device */
+/* open, close, read, ioctl, poll, kqfilter -- XXX should be a generic device */
#define cdev_log_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
+ (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
(dev_type_mmap((*))) enodev, D_KQFILTER, dev_init(c,n,kqfilter) }
/* open */
@@ -287,41 +287,41 @@ extern struct cdevsw cdevsw[];
dev_init(c,n,open), (dev_type_close((*))) enodev, \
(dev_type_read((*))) enodev, (dev_type_write((*))) enodev, \
(dev_type_ioctl((*))) enodev, (dev_type_stop((*))) enodev, \
- 0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev }
+ 0, (dev_type_poll((*))) enodev, (dev_type_mmap((*))) enodev }
-/* open, close, read, write, ioctl, select, kqfilter -- XXX should be generic device */
+/* open, close, read, write, ioctl, poll, kqfilter -- XXX should be generic device */
#define cdev_bpftun_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, \
+ 0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev, \
D_KQFILTER, dev_init(c,n,kqfilter) }
/* open, close, ioctl */
#define cdev_lkm_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev }
/* open, close, ioctl */
#define cdev_ch_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev }
/* open, close, ioctl */
#define cdev_uk_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev }
/* open, close, ioctl */
#define cdev_ses_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev }
/* open, close, read, ioctl */
@@ -335,34 +335,34 @@ extern struct cdevsw cdevsw[];
#define cdev_fb_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
dev_init(c,n,mmap) }
-/* open, close, read, write, ioctl, select, kqfilter */
+/* open, close, read, write, ioctl, poll, kqfilter */
#define cdev_audio_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
+ (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
dev_init(c,n,mmap), D_KQFILTER, dev_init(c,n,kqfilter) }
-/* open, close, read, write, ioctl, select, nokqfilter */
+/* open, close, read, write, ioctl, poll, nokqfilter */
#define cdev_midi_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
+ (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
(dev_type_mmap((*))) enodev }
#define cdev_svr4_net_init(c,n) { \
dev_init(c,n,open), (dev_type_close((*))) enodev, \
(dev_type_read((*))) enodev, (dev_type_write((*))) enodev, \
(dev_type_ioctl((*))) enodev, (dev_type_stop((*))) nullop, \
- 0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev }
+ 0, (dev_type_poll((*))) enodev, (dev_type_mmap((*))) enodev }
-/* open, close, read, write, ioctl, select, nokqfilter */
+/* open, close, read, write, ioctl, poll, nokqfilter */
#define cdev_xfs_init(c, n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
+ (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
(dev_type_mmap((*))) enodev }
/* open, close, read */
@@ -372,73 +372,73 @@ extern struct cdevsw cdevsw[];
(dev_type_stop((*))) enodev, 0, seltrue, \
(dev_type_mmap((*))) enodev, 0 }
-/* open, close, read, write, ioctl, stop, tty, select, mmap, kqfilter */
+/* open, close, read, write, ioctl, stop, tty, poll, mmap, kqfilter */
#define cdev_wsdisplay_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
- dev_init(c,n,tty), ttselect, dev_init(c,n,mmap), \
+ dev_init(c,n,tty), ttpoll, dev_init(c,n,mmap), \
D_KQFILTER, dev_init(c,n,kqfilter) }
-/* open, close, read, write, ioctl, select, kqfilter */
+/* open, close, read, write, ioctl, poll, kqfilter */
#define cdev_random_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, \
+ 0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev, \
D_KQFILTER, dev_init(c,n,kqfilter) }
void randomattach(void);
-/* open, close, ioctl, select, nokqfilter */
+/* open, close, ioctl, poll, nokqfilter */
#define cdev_usb_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
+ (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
(dev_type_mmap((*))) enodev }
/* open, close, write, ioctl */
#define cdev_ulpt_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev }
+ 0, (dev_type_poll((*))) enodev, (dev_type_mmap((*))) enodev }
/* open, close, ioctl */
#define cdev_pf_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev }
-/* open, close, read, write, ioctl, select, nokqfilter */
+/* open, close, read, write, ioctl, poll, nokqfilter */
#define cdev_urio_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev }
+ 0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev }
-/* open, close, read, write, ioctl, select, kqfilter */
+/* open, close, read, write, ioctl, poll, kqfilter */
#define cdev_usbdev_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, D_KQFILTER, \
+ 0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev, D_KQFILTER, \
dev_init(c,n,kqfilter) }
/* open, close, init */
#define cdev_pci_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev }
/* open, close, init */
#define cdev_iop_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev }
/* open, close, ioctl */
#define cdev_radio_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
+ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
(dev_type_mmap((*))) enodev }
/* open, close, write, ioctl */
diff --git a/sys/sys/file.h b/sys/sys/file.h
index 5f8fdd65e4b..cad1e3ea418 100644
--- a/sys/sys/file.h
+++ b/sys/sys/file.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.h,v 1.22 2003/08/06 20:51:35 deraadt Exp $ */
+/* $OpenBSD: file.h,v 1.23 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: file.h,v 1.11 1995/03/26 20:24:13 jtc Exp $ */
/*
@@ -51,7 +51,7 @@ struct fileops {
struct ucred *);
int (*fo_ioctl)(struct file *, u_long, caddr_t,
struct proc *);
- int (*fo_select)(struct file *, int, struct proc *);
+ int (*fo_poll)(struct file *, int, struct proc *);
int (*fo_kqfilter)(struct file *, struct knote *);
int (*fo_stat)(struct file *, struct stat *, struct proc *);
int (*fo_close)(struct file *, struct proc *);
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index 54d9a00c5ab..cbf47961d26 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: socketvar.h,v 1.31 2003/06/02 23:28:21 millert Exp $ */
+/* $OpenBSD: socketvar.h,v 1.32 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
/*-
@@ -237,7 +237,7 @@ int soo_write(struct file *fp, off_t *, struct uio *uio,
struct ucred *cred);
int soo_ioctl(struct file *fp, u_long cmd, caddr_t data,
struct proc *p);
-int soo_select(struct file *fp, int which, struct proc *p);
+int soo_poll(struct file *fp, int events, struct proc *p);
int soo_kqfilter(struct file *fp, struct knote *kn);
int soo_close(struct file *fp, struct proc *p);
int soo_stat(struct file *, struct stat *, struct proc *);
diff --git a/sys/sys/specdev.h b/sys/sys/specdev.h
index 4218f80edca..bb95a71025d 100644
--- a/sys/sys/specdev.h
+++ b/sys/sys/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
diff --git a/sys/sys/tty.h b/sys/sys/tty.h
index c966bb2bfb0..6ea4f7512c4 100644
--- a/sys/sys/tty.h
+++ b/sys/sys/tty.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.h,v 1.14 2003/06/02 23:28:22 millert Exp $ */
+/* $OpenBSD: tty.h,v 1.15 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: tty.h,v 1.30.4.1 1996/06/02 09:08:13 mrg Exp $ */
/*-
@@ -245,7 +245,7 @@ int ttioctl(struct tty *tp, u_long com, caddr_t data, int flag,
struct proc *p);
int ttread(struct tty *tp, struct uio *uio, int flag);
void ttrstrt(void *tp);
-int ttselect(dev_t device, int rw, struct proc *p);
+int ttpoll(dev_t device, int events, struct proc *p);
int ttkqfilter(dev_t dev, struct knote *kn);
void ttsetwater(struct tty *tp);
int ttspeedtab(int speed, struct speedtab *table);
@@ -281,7 +281,7 @@ int cttyopen(dev_t, int, int, struct proc *);
int cttyread(dev_t, struct uio *, int);
int cttywrite(dev_t, struct uio *, int);
int cttyioctl(dev_t, u_long, caddr_t, int, struct proc *);
-int cttyselect(dev_t, int, struct proc *);
+int cttypoll(dev_t, int, struct proc *);
int clalloc(struct clist *, int, int);
void clfree(struct clist *);
diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c
index 218f5f49024..54014263925 100644
--- a/sys/ufs/ext2fs/ext2fs_vnops.c
+++ b/sys/ufs/ext2fs/ext2fs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_vnops.c,v 1.30 2003/08/25 23:26:55 tedu Exp $ */
+/* $OpenBSD: ext2fs_vnops.c,v 1.31 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */
/*
@@ -1374,7 +1374,7 @@ struct vnodeopv_entry_desc ext2fs_vnodeop_entries[] = {
{ &vop_write_desc, ext2fs_write }, /* write */
{ &vop_lease_desc, ufs_lease_check }, /* lease */
{ &vop_ioctl_desc, ufs_ioctl }, /* ioctl */
- { &vop_select_desc, ufs_select }, /* select */
+ { &vop_poll_desc, ufs_poll }, /* poll */
{ &vop_kqfilter_desc, vop_generic_kqfilter }, /* kqfilter */
{ &vop_fsync_desc, ext2fs_fsync }, /* fsync */
{ &vop_remove_desc, ext2fs_remove }, /* remove */
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 8b3b9537121..5c41f97d070 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vnops.c,v 1.29 2003/06/02 23:28:23 millert Exp $ */
+/* $OpenBSD: ffs_vnops.c,v 1.30 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */
/*
@@ -79,7 +79,7 @@ struct vnodeopv_entry_desc ffs_vnodeop_entries[] = {
{ &vop_write_desc, ffs_write }, /* write */
{ &vop_lease_desc, ufs_lease_check }, /* lease */
{ &vop_ioctl_desc, ufs_ioctl }, /* ioctl */
- { &vop_select_desc, ufs_select }, /* select */
+ { &vop_poll_desc, ufs_poll }, /* poll */
{ &vop_kqfilter_desc, ufs_kqfilter }, /* kqfilter */
{ &vop_revoke_desc, ufs_revoke }, /* revoke */
{ &vop_fsync_desc, ffs_fsync }, /* fsync */
diff --git a/sys/ufs/lfs/lfs_vnops.c b/sys/ufs/lfs/lfs_vnops.c
index fab2b478857..b0bf6c05aff 100644
--- a/sys/ufs/lfs/lfs_vnops.c
+++ b/sys/ufs/lfs/lfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs_vnops.c,v 1.9 2003/06/02 23:28:23 millert Exp $ */
+/* $OpenBSD: lfs_vnops.c,v 1.10 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: lfs_vnops.c,v 1.11 1996/05/11 18:27:41 mycroft Exp $ */
/*
@@ -78,7 +78,7 @@ struct vnodeopv_entry_desc lfs_vnodeop_entries[] = {
{ &vop_write_desc, lfs_write }, /* write */
{ &vop_lease_desc, ufs_lease_check }, /* lease */
{ &vop_ioctl_desc, ufs_ioctl }, /* ioctl */
- { &vop_select_desc, ufs_select }, /* select */
+ { &vop_poll_desc, ufs_poll }, /* poll */
{ &vop_mmap_desc, ufs_mmap }, /* mmap */
{ &vop_fsync_desc, lfs_fsync }, /* fsync */
{ &vop_seek_desc, ufs_seek }, /* seek */
diff --git a/sys/ufs/mfs/mfs_vnops.c b/sys/ufs/mfs/mfs_vnops.c
index 1bd85c94a8b..c0e1cb2aeb1 100644
--- a/sys/ufs/mfs/mfs_vnops.c
+++ b/sys/ufs/mfs/mfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfs_vnops.c,v 1.23 2003/06/02 23:28:23 millert Exp $ */
+/* $OpenBSD: mfs_vnops.c,v 1.24 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: mfs_vnops.c,v 1.8 1996/03/17 02:16:32 christos Exp $ */
/*
@@ -65,7 +65,7 @@ struct vnodeopv_entry_desc mfs_vnodeop_entries[] = {
{ &vop_read_desc, mfs_read }, /* read */
{ &vop_write_desc, mfs_write }, /* write */
{ &vop_ioctl_desc, mfs_ioctl }, /* ioctl */
- { &vop_select_desc, mfs_select }, /* select */
+ { &vop_poll_desc, mfs_poll }, /* poll */
{ &vop_revoke_desc, mfs_revoke }, /* revoke */
{ &vop_fsync_desc, spec_fsync }, /* fsync */
{ &vop_remove_desc, mfs_remove }, /* remove */
diff --git a/sys/ufs/mfs/mfsnode.h b/sys/ufs/mfs/mfsnode.h
index 8731a303099..6b41318ec7b 100644
--- a/sys/ufs/mfs/mfsnode.h
+++ b/sys/ufs/mfs/mfsnode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfsnode.h,v 1.10 2003/06/02 23:28:23 millert Exp $ */
+/* $OpenBSD: mfsnode.h,v 1.11 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: mfsnode.h,v 1.3 1996/02/09 22:31:31 christos Exp $ */
/*
@@ -60,7 +60,7 @@ struct mfsnode {
#define mfs_setattr mfs_badop
#define mfs_read mfs_badop
#define mfs_write mfs_badop
-#define mfs_select mfs_badop
+#define mfs_poll mfs_badop
#define mfs_mmap mfs_badop
#define mfs_seek mfs_badop
#define mfs_remove mfs_badop
diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h
index 77869efd76d..0f26001a1db 100644
--- a/sys/ufs/ufs/ufs_extern.h
+++ b/sys/ufs/ufs/ufs_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_extern.h,v 1.19 2003/06/02 23:28:23 millert Exp $ */
+/* $OpenBSD: ufs_extern.h,v 1.20 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: ufs_extern.h,v 1.5 1996/02/09 22:36:03 christos Exp $ */
/*-
@@ -85,7 +85,7 @@ int ufs_rename(void *);
#define ufs_revoke vop_generic_revoke
int ufs_rmdir(void *);
int ufs_seek(void *);
-int ufs_select(void *);
+int ufs_poll(void *);
int ufs_kqfilter(void *);
int ufs_setattr(void *);
int ufs_strategy(void *);
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 47c70e76a7e..7ed0c02506e 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_vnops.c,v 1.49 2003/08/15 20:32:21 tedu Exp $ */
+/* $OpenBSD: ufs_vnops.c,v 1.50 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */
/*
@@ -53,6 +53,7 @@
#include <sys/dirent.h>
#include <sys/lockf.h>
#include <sys/event.h>
+#include <sys/poll.h>
#include <uvm/uvm_extern.h>
@@ -582,23 +583,19 @@ ufs_ioctl(v)
/* ARGSUSED */
int
-ufs_select(v)
+ufs_poll(v)
void *v;
{
-#if 0
- 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;
-#endif
/*
* We should really check to see if I/O is possible.
*/
- return (1);
+ return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
}
/*
diff --git a/sys/xfs/xfs_vopdefs.h b/sys/xfs/xfs_vopdefs.h
index c3220589e1d..401a4015727 100644
--- a/sys/xfs/xfs_vopdefs.h
+++ b/sys/xfs/xfs_vopdefs.h
@@ -24,8 +24,8 @@ NNPFS_VOP_DEF(write);
NNPFS_VOP_DEF(lease);
#define HAVE_VOP_IOCTL 1
NNPFS_VOP_DEF(ioctl);
-#define HAVE_VOP_SELECT 1
-NNPFS_VOP_DEF(select);
+#define HAVE_VOP_POLL 1
+NNPFS_VOP_DEF(poll);
#define HAVE_VOP_KQFILTER 1
NNPFS_VOP_DEF(kqfilter);
#define HAVE_VOP_REVOKE 1