From zach@uffdaonline.net  Thu Nov  2 01:37:53 2000
Return-Path: <zach@uffdaonline.net>
Received: from uffdaonline.net (host35.uffdaonline.net [207.109.235.35])
	by hub.freebsd.org (Postfix) with ESMTP id AA75437B4D7
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  2 Nov 2000 01:37:52 -0800 (PST)
Received: by uffdaonline.net (Postfix, from userid 1000)
	id 7B329207F; Thu,  2 Nov 2000 03:36:12 -0600 (CST)
Message-Id: <20001102093612.7B329207F@uffdaonline.net>
Date: Thu,  2 Nov 2000 03:36:12 -0600 (CST)
From: zach@uffdaonline.net
Reply-To: zach@uffdaonline.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: [patch] /dev/dsp is sometimes busy when not opened...
X-Send-Pr-Version: 3.2

>Number:         22532
>Category:       kern
>Synopsis:       [patch] /dev/dsp is sometimes busy when not opened...
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 02 01:40:00 PST 2000
>Closed-Date:    Sun Nov 25 03:41:36 PST 2001
>Last-Modified:  Sun Nov 25 03:41:53 PST 2001
>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:
State-Changed-From-To: open->feedback 
State-Changed-By: iedowse 
State-Changed-When: Sat Nov 17 14:09:45 PST 2001 
State-Changed-Why:  

Does this problem still exist? The code in dsp.c seems to have 
changed a lot since this was submitted. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=22532 

From: Peter Pentchev <roam@ringlet.net>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/22532: [patch] /dev/dsp is sometimes busy when not opened...
Date: Sun, 25 Nov 2001 13:34:49 +0200

 Added to the PR audit trail..
 
 G'luck,
 Peter
 
 -- 
 "yields falsehood, when appended to its quotation." yields falsehood, when appended to its quotation.
 
 ----- Forwarded message from "Zach N. Heilig" <zach@uffdaonline.net> -----
 
 To: <iedowse@FreeBSD.org>
 Cc: freebsd-bugs@FreeBSD.org
 Subject: Re: kern/22532: [patch] /dev/dsp is sometimes busy when not opened...
 From: zach@uffdaonline.net (Zach N. Heilig)
 Date: 25 Nov 2001 02:49:38 -0600
 
 <iedowse@FreeBSD.org> writes:
 
 > Synopsis: [patch] /dev/dsp is sometimes busy when not opened...
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: iedowse
 > State-Changed-When: Sat Nov 17 14:09:45 PST 2001
 > State-Changed-Why: 
 > 
 > Does this problem still exist? The code in dsp.c seems to have
 > changed a lot since this was submitted.
 > 
 > http://www.FreeBSD.org/cgi/query-pr.cgi?pr=22532
 
 Yes, this was actually fixed almost right away.
 
 -- 
 Zach Heilig <zach@uffdaonline.net>
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-bugs" in the body of the message
 
 
 ----- End forwarded message -----
State-Changed-From-To: feedback->closed 
State-Changed-By: roam 
State-Changed-When: Sun Nov 25 03:41:36 PST 2001 
State-Changed-Why:  
Originator confirms the problem was fixed. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=22532 
>Unformatted:
