NetBSD Problem Report #13829
Received: (qmail 13475 invoked from network); 30 Aug 2001 12:19:17 -0000
Message-Id: <200108301224.f7UCO8P08239@horn.ics.muni.cz>
Date: Thu, 30 Aug 2001 14:24:08 +0200 (MEST)
From: salvet@ics.muni.cz
Reply-To: salvet@ics.muni.cz
To: gnats-bugs@gnats.netbsd.org
Subject: select/poll incorrect on audio devices (+fix)
X-Send-Pr-Version: 3.95
>Number: 13829
>Category: kern
>Synopsis: select/poll incorrect on audio devices (+fix)
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: gson
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Aug 30 12:20:00 +0000 2001
>Closed-Date: Sun Jun 02 02:14:29 +0000 2002
>Last-Modified: Sun Jun 02 02:14:29 +0000 2002
>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:
State-Changed-From-To: open->closed
State-Changed-By: gson
State-Changed-When: Sat Jun 1 19:13:30 PDT 2002
State-Changed-Why:
Committed a slightly different fix which retains the capability to
poll for the synthetic silence returned when reading from a half
duplex device in play mode, and commented the code.
Responsible-Changed-From-To: kern-bug-people->gson
Responsible-Changed-By: gson
Responsible-Changed-When: Sat Jun 1 19:13:30 PDT 2002
Responsible-Changed-Why:
I'll submit a pullup request.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.