NetBSD Problem Report #20478

Received: (qmail 20419 invoked by uid 605); 24 Feb 2003 14:14:52 -0000
Message-Id: <200302241414.h1OEElE22702@o065135.ap.plala.or.jp>
Date: Mon, 24 Feb 2003 23:14:46 +0900 (JST)
From: itohy@netbsd.org
Sender: gnats-bugs-owner@netbsd.org
Reply-To: itohy@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: revoke(2) on a device file does not close the device properly
X-Send-Pr-Version: 3.95

>Number:         20478
>Category:       kern
>Synopsis:       revoke(2) on a device file does not close the device properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 24 14:15:00 +0000 2003
>Closed-Date:    
>Last-Modified:  
>Originator:     ITOH Yasufumi
>Release:        NetBSD 1.6K
>Organization:
>Environment:
System: NetBSD pino.my.domain 1.6K NetBSD 1.6K (PINO) #351: Mon Nov 11 23:43:52 JST 2002 itohy@pino.my.domain:/w/src/sys/arch/i386/compile/PINO i386
Architecture: i386
Machine: i386

>Description:
	revoke(2) on a device file invalidates all file descriptors
	associated to the device, but it doesn't cause
	xxclose() driver interface called.

	That is, the device driver can't know ``not opened'' state.
	All descriptors are already gone, but xxclose() hasn't be called.

	If the driver implements locking (in xxopen() and xxclose())
	to avoid multiple open, the device can't be opened any longer.

>How-To-Repeat:
	Here's a sample program.

	revoke.c:
	#include <unistd.h>
	main()
	{
		return revoke("/dev/audio");
	}

	# cc -o revoketest revoke.c
	# audiorecord foo.wav &
	# ./revoketest			# this cause recording stop
	# audiorecord foo.wav
	audiorecord: failed to open /dev/sound0: Device busy
	# audioplay foo.wav
	audioplay: failed to open /dev/sound0: Device busy
	#

>Fix:
	ENOCLUE
	Change sys_revoke() ?

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

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.