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 :-)
This commit is contained in:
Garance A Drosehn 2001-04-04 23:27:35 +00:00
parent 0cad4cb4e6
commit 0832fc6494
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75204

View File

@ -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