Subject: kern/13829: select/poll incorrect on audio devices (+fix)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <salvet@ics.muni.cz>
List: netbsd-bugs
Date: 08/30/2001 14:24:08
>Number: 13829
>Category: kern
>Synopsis: select/poll incorrect on audio devices (+fix)
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Aug 30 05:20:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Zdenek Salvet
>Release: 1.5.1
>Organization:
Institute of Computer Science of Masaryk University, Brno, Czech Republic
>Environment:
>Description:
rat does not work reliably and consumes 100% CPU time
because it uses select() to manage
non-blocking I/O to audio device and select() acts weird
>How-To-Repeat:
>Fix:
--- sys/dev/audio.c.orig Mon Aug 20 17:07:23 2001
+++ sys/dev/audio.c Mon Aug 20 17:18:16 2001
@@ -1777,14 +1777,13 @@
DPRINTF(("audio_poll: events=0x%x mode=%d\n", events, sc->sc_mode));
if (events & (POLLIN | POLLRDNORM))
- if ((sc->sc_mode & AUMODE_PLAY) ?
- sc->sc_pr.stamp > sc->sc_wstamp :
- sc->sc_rr.used > sc->sc_rr.usedlow)
+ if ((sc->sc_mode & AUMODE_RECORD) &&
+ sc->sc_rr.used >= sc->sc_rr.blksize )
revents |= events & (POLLIN | POLLRDNORM);
if (events & (POLLOUT | POLLWRNORM))
- if (sc->sc_mode & AUMODE_RECORD ||
- sc->sc_pr.used <= sc->sc_pr.usedlow)
+ if ((sc->sc_mode & AUMODE_PLAY) &&
+ sc->sc_pr.used <= sc->sc_pr.usedhigh)
revents |= events & (POLLOUT | POLLWRNORM);
if (revents == 0) {
>Release-Note:
>Audit-Trail:
>Unformatted: