Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Feb 1998 14:58:40 +0100 (MET)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        hackers@FreeBSD.ORG
Subject:   minor bug (fix) in pcaudio and pcm drivers
Message-ID:  <199802211358.OAA02827@labinfo.iet.unipi.it>

next in thread | raw e-mail | index | archive | help
A minor bugfix for my audio driver and pcaudio. The problem is with
signals delivered to a process writing to the audio device the
system: if you try

	cat /dev/zero > /dev/dsp (or cat /dev/zero > /dev/pcaudio)

and press Ctrl-C : for a second or two the system appears to freeze
(e.g. the cursor will disappear if you move the mouse, xclock
blocks, etc.). I think that interrupts etc. still run so the problem
is not too terrible, but still annoying

The problem has been there for a long time, since I thought that a
ctrl-c would cause tsleep() to return EINTR, not ERESTART. If someone
can explain why i'd be glad to know...
In any case the fix is trivial (attached below -- file dmabuf.c).
The same problem is present in /sys/i386/isa/pcaudio.c (at least on
2.2.1 -- i am not too -current so i don't know if it has been fixed
recently) where an ERESTART returned by the tsleep() is discarded.
The fix there is equally simple -- remove the test for ERESTART in
the two lines which use it, which look like this:

	    if (error != 0 && error != ERESTART) {

While you are at it, there is a minor bug in sb_dsp.c -- the driver
reports ESS cards as able to do 16-bit, but it has no support for it.
So, in file /sys/i386/isa/snd/sb_dsp.c line 621 below should be removed:

621:    d->audio_fmt |= AFMT_S16_LE; /* not yet... */

Ok, here follows the simple patch to /sys/i386/isa/snd/dmabuf.c

	cheers
	luigi

--- /tmp/dmabuf.c	Sat Feb 21 14:10:48 1998
+++ dmabuf.c	Sat Feb 21 14:03:07 1998
@@ -273,7 +273,7 @@
 	    if (ret == EINTR)
 		d->flags |= SND_F_ABORTING ;
 	    splx(s);
-	    if (ret == EINTR)
+	    if (ret == EINTR || ret == ERESTART)
 		break ;
             continue;
         }
@@ -556,7 +556,7 @@
 	    if (ret == EINTR)
 		d->flags |= SND_F_ABORTING ;
 	    splx(s);
-	    if (ret == EINTR)
+	    if (ret == EINTR || ret == ERESTART)
 		break ;
             continue;
         }

-----------------------------+--------------------------------------
Luigi Rizzo                  |  Dip. di Ingegneria dell'Informazione
email: luigi@iet.unipi.it    |  Universita' di Pisa
tel: +39-50-568533           |  via Diotisalvi 2, 56126 PISA (Italy)
fax: +39-50-568522           |  http://www.iet.unipi.it/~luigi/
_____________________________|______________________________________

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802211358.OAA02827>