summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-10-06 16:06:13 +0000
committermillert <millert@openbsd.org>2003-10-06 16:06:13 +0000
commit9ebeff7abcc9b5221a1a54d11b6b85553966bdcc (patch)
treefdf1c7f3420432034d3697152edb9ffd2c34980a
parentpower management status reg. definition; from netbsd. (diff)
downloadwireguard-openbsd-9ebeff7abcc9b5221a1a54d11b6b85553966bdcc.tar.xz
wireguard-openbsd-9ebeff7abcc9b5221a1a54d11b6b85553966bdcc.zip
Implement a real xfs_devpoll() and don't rely on xfs_realselect().
Tested by beck@
-rw-r--r--sys/xfs/xfs_dev-bsd.c19
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