diff options
author | 2003-09-23 16:51:11 +0000 | |
---|---|---|
committer | 2003-09-23 16:51:11 +0000 | |
commit | 154dfaaa7e8e47825c6990a73b3eba25e82ebbb9 (patch) | |
tree | bae4f380ce55fc233a68444dffc895a9dabf0b91 /sys/dev/sequencer.c | |
parent | regen (Prepare for conversion of select backend -> poll) (diff) | |
download | wireguard-openbsd-154dfaaa7e8e47825c6990a73b3eba25e82ebbb9.tar.xz wireguard-openbsd-154dfaaa7e8e47825c6990a73b3eba25e82ebbb9.zip |
Replace select backends with poll backends. selscan() and pollscan()
now call the poll backend. With this change we implement greater
poll(2) functionality instead of emulating it via the select backend.
Adapted from NetBSD and including some changes from FreeBSD.
Tested by many, deraadt@ OK
Diffstat (limited to 'sys/dev/sequencer.c')
-rw-r--r-- | sys/dev/sequencer.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/sys/dev/sequencer.c b/sys/dev/sequencer.c index 75c56f9ded0..517a3fdc523 100644 --- a/sys/dev/sequencer.c +++ b/sys/dev/sequencer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sequencer.c,v 1.8 2002/07/27 08:01:47 nordin Exp $ */ +/* $OpenBSD: sequencer.c,v 1.9 2003/09/23 16:51:12 millert Exp $ */ /* $NetBSD: sequencer.c,v 1.13 1998/11/25 22:17:07 augustss Exp $ */ /* @@ -632,30 +632,31 @@ sequencerioctl(dev, cmd, addr, flag, p) } int -sequencerselect(dev, rw, p) +sequencerpoll(dev, events, p) dev_t dev; - int rw; + int events; struct proc *p; { struct sequencer_softc *sc = &seqdevs[SEQUENCERUNIT(dev)]; + int revents = 0; - DPRINTF(("sequencerselect: %p rw=0x%x\n", sc, rw)); + DPRINTF(("sequencerpoll: %p rw=0x%x\n", sc, events)); - switch (rw) { - case FREAD: + if (events & (POLLIN | POLLRDNORM)) { if (!SEQ_QEMPTY(&sc->inq)) - return (1); - selrecord(p, &sc->rsel); - break; - - case FWRITE: + revents |= events & (POLLIN | POLLRDNORM); + } + if (events & (POLLOUT | POLLWRNORM)) { if (SEQ_QLEN(&sc->outq) < sc->lowat) - return (1); - selrecord(p, &sc->wsel); - break; + revents |= events & (POLLOUT | POLLWRNORM); } - - return (0); + if (revents == 0) { + if (events & (POLLIN | POLLRDNORM)) + selrecord(p, &sc->rsel); + if (events & (POLLOUT | POLLWRNORM)) + selrecord(p, &sc->wsel); + } + return (revents); } void |