diff options
| author | 2003-09-23 16:51:11 +0000 | |
|---|---|---|
| committer | 2003-09-23 16:51:11 +0000 | |
| commit | 154dfaaa7e8e47825c6990a73b3eba25e82ebbb9 (patch) | |
| tree | bae4f380ce55fc233a68444dffc895a9dabf0b91 /sys/kern/subr_log.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/kern/subr_log.c')
| -rw-r--r-- | sys/kern/subr_log.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index 292bf55e35f..98eb65c87ca 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_log.c,v 1.10 2003/07/21 22:44:50 tedu Exp $ */ +/* $OpenBSD: subr_log.c,v 1.11 2003/09/23 16:51:12 millert Exp $ */ /* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */ /* @@ -46,6 +46,7 @@ #include <sys/signalvar.h> #include <sys/syslog.h> #include <sys/conf.h> +#include <sys/poll.h> #define LOG_RDPRI (PZERO + 1) @@ -178,25 +179,22 @@ logread(dev, uio, flag) /*ARGSUSED*/ int -logselect(dev, rw, p) +logpoll(dev, events, p) dev_t dev; - int rw; + int events; struct proc *p; { + int revents = 0; int s = splhigh(); - switch (rw) { - - case FREAD: - if (msgbufp->msg_bufr != msgbufp->msg_bufx) { - splx(s); - return (1); - } - selrecord(p, &logsoftc.sc_selp); - break; + if (events & (POLLIN | POLLRDNORM)) { + if (msgbufp->msg_bufr != msgbufp->msg_bufx) + revents |= events & (POLLIN | POLLRDNORM); + else + selrecord(p, &logsoftc.sc_selp); } splx(s); - return (0); + return (revents); } int |
