NetBSD Problem Report #20478

Received: (qmail 20419 invoked by uid 605); 24 Feb 2003 14:14:52 -0000
Message-Id: <>
Date: Mon, 24 Feb 2003 23:14:46 +0900 (JST)
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
>Originator:     ITOH Yasufumi
>Release:        NetBSD 1.6K
System: NetBSD 1.6K NetBSD 1.6K (PINO) #351: Mon Nov 11 23:43:52 JST 2002 i386
Architecture: i386
Machine: i386

	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.

	Here's a sample program.

	#include <unistd.h>
		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

	Change sys_revoke() ?


NetBSD Home
NetBSD PR Database Search

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