diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-10-06 16:06:14 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-10-06 16:06:14 +0000 |
commit | 9833e716b0ee3ab109e9016ed58ffb7526354466 (patch) | |
tree | 2b703534539da769b2a36119ecda40dab7315d31 /sys/xfs/xfs_dev-bsd.c | |
parent | d7468939b53dcf467c79b3047ac755e4e201ef3b (diff) |
Implement a real xfs_devpoll() and don't rely on xfs_realselect().
Tested by beck@
Diffstat (limited to 'sys/xfs/xfs_dev-bsd.c')
-rw-r--r-- | sys/xfs/xfs_dev-bsd.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/xfs/xfs_dev-bsd.c b/sys/xfs/xfs_dev-bsd.c index b0ae2516079..9316de4cff9 100644 --- a/sys/xfs/xfs_dev-bsd.c +++ b/sys/xfs/xfs_dev-bsd.c @@ -79,6 +79,7 @@ xfs_devioctl(dev_t dev, return ENOTTY; } +#ifdef HAVE_VOP_SELECT static int xfs_realselect(dev_t dev, d_thread_t *p, void *wql) { @@ -94,12 +95,13 @@ xfs_realselect(dev_t dev, d_thread_t *p, void *wql) #endif return 0; } - +#endif #ifdef HAVE_VOP_POLL int xfs_devpoll(dev_t dev, int events, d_thread_t * p) { + struct xfs_channel *chan = &xfs_channel[minor(dev)]; #ifdef NNPFS_DEBUG char devname[64]; #endif @@ -108,12 +110,19 @@ xfs_devpoll(dev_t dev, int events, d_thread_t * p) xfs_devtoname_r (dev, devname, sizeof(devname)), events)); - if (!(events & (POLLIN | POLLRDNORM))) - return 0; + if ((events & (POLLIN | POLLRDNORM)) == 0) + return 0; /* only supports read */ - return xfs_realselect(dev, p, NULL); -} + if (!xfs_emptyq(&chan->messageq)) + return (events & (POLLIN | POLLRDNORM)); +#ifdef HAVE_THREE_ARGUMENT_SELRECORD + selrecord (p, &chan->selinfo, wql); +#else + selrecord (p, &chan->selinfo); +#endif + return 0; +} #endif #ifdef HAVE_VOP_SELECT |