Skip site navigation (1)Skip section navigation (2)
Date:      Thu,  2 Nov 2000 03:36:12 -0600 (CST)
From:      zach@uffdaonline.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/22532: [patch] /dev/dsp is sometimes busy when not opened...
Message-ID:  <20001102093612.7B329207F@uffdaonline.net>

next in thread | raw e-mail | index | archive | help

>Number:         22532
>Category:       kern
>Synopsis:       [patch] /dev/dsp is sometimes busy when not opened...
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 02 01:40:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Zach N. Heilig
>Release:        FreeBSD 4.1.1-STABLE i386
>Organization:
>Environment:

>Description:

when opening /dev/dsp for reading+writing, the open function sometimes
forgets to reset the read channel busy flag if the open fails (for
example: the write channel was busy, but the read channel was not).

>How-To-Repeat:

#include <fcntl.h>
int
main(void)
{
  open("/dev/dsp", O_WRONLY);
  open("/dev/dsp", O_RDWR);
}

notice that it is now impossible to open /dev/dsp for reading...

>Fix:

Index: dsp.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/sound/pcm/dsp.c,v
retrieving revision 1.15.2.4
diff -u -r1.15.2.4 dsp.c
--- dsp.c	2000/10/05 05:05:06	1.15.2.4
+++ dsp.c	2000/11/01 13:27:09
@@ -99,7 +99,11 @@
 					rdch->flags &= ~CHN_F_BUSY;
 				return EBUSY;
 			}
-		} else return EBUSY;
+		} else {
+			if (rdch && (oflags & FREAD))
+				rdch->flags &= ~CHN_F_BUSY;
+			return EBUSY;
+		}
 	}
 	d->aplay[chan] = wrch;
 	d->arec[chan] = rdch;

>Release-Note:
>Audit-Trail:
>Unformatted:


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




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