diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-09-23 16:51:15 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-09-23 16:51:15 +0000 |
commit | 6bb276a1685d8546283d224a3d249c66cc329264 (patch) | |
tree | 5e1c80d6cad38a8a82f5832e1e315103e7029eb9 /sys/miscfs/fdesc | |
parent | 96675671ec2520ade2f83b31563ab4da72bd443d (diff) |
Replace select backends with poll backends. selscan() and pollscan()
now call the poll backend. With this change we implement greater
poll(2) functionality instead of emulating it via the select backend.
Adapted from NetBSD and including some changes from FreeBSD.
Tested by many, deraadt@ OK
Diffstat (limited to 'sys/miscfs/fdesc')
-rw-r--r-- | sys/miscfs/fdesc/fdesc_vnops.c | 23 |
1 files changed, 11 insertions, 12 deletions
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 |