diff options
Diffstat (limited to 'sys/miscfs/fifofs/fifo_vnops.c')
-rw-r--r-- | sys/miscfs/fifofs/fifo_vnops.c | 32 |
1 files changed, 15 insertions, 17 deletions
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 |