summaryrefslogtreecommitdiffstats
path: root/sys/net/bpf.c
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2001-04-04 23:27:35 +0000
committergad <gad@FreeBSD.org>2001-04-04 23:27:35 +0000
commit08f68aa7974a03094e34047f66fa0b3c39b0ad61 (patch)
tree4dca80b2d87ce27607d4efb1205a183327ef9973 /sys/net/bpf.c
parente1c6e50d7281b90ecadee85d7fea77f46aa92ec7 (diff)
downloadFreeBSD-src-08f68aa7974a03094e34047f66fa0b3c39b0ad61.zip
FreeBSD-src-08f68aa7974a03094e34047f66fa0b3c39b0ad61.tar.gz
Fix bpf devices so select() recognizes that they are always writable.
PR: 9355 Submitted by: Bruce Evans <bde@zeta.org.au> Reviewed by: Garrett Rooney <rooneg@electricjellyfish.net> (see pr :-)
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r--sys/net/bpf.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 74a8c5b..c947c1a 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -972,18 +972,21 @@ bpfpoll(dev, events, p)
struct proc *p;
{
struct bpf_d *d;
- int revents = 0;
+ int revents;
- /*
- * An imitation of the FIONREAD ioctl code.
- */
d = dev->si_drv1;
-
if (d->bd_bif == NULL)
return (ENXIO);
+ revents = events & (POLLOUT | POLLWRNORM);
BPFD_LOCK(d);
if (events & (POLLIN | POLLRDNORM)) {
+ /*
+ * An imitation of the FIONREAD ioctl code.
+ * XXX not quite. An exact imitation:
+ * if (d->b_slen != 0 ||
+ * (d->bd_hbuf != NULL && d->bd_hlen != 0)
+ */
if (d->bd_hlen != 0 || (d->bd_immediate && d->bd_slen != 0))
revents |= events & (POLLIN | POLLRDNORM);
else
OpenPOWER on IntegriCloud