Subject: Re: dev/audiobell.c proposal
To: NetBSD Kernel Technical Discussion List <tech-kern@NetBSD.ORG>
From: Greg A. Woods <email@example.com>
Date: 01/15/2004 18:32:53
[ On Thursday, January 15, 2004 at 23:17:43 (+0100), Quentin Garnier wrote: ]
> Subject: Re: dev/audiobell.c proposal
> The point is to make it optional, in order to have it used by devices for
> which it makes sense.
It doesn't really ever make good sense for any device. Any time you
think you need to call the driver close routine every time a process
closes a device file then you've got something drastically wrong with
your device driver interface model.
Calling the driver close routine only once on last close is all that
should ever be necessary.
The traditional work-around (i.e. without re-designing the driver
interface model) has been to simply restrict the device to allow only
one open at a time.
> Most devices just need to release resources once unused, because the
> amount of user processes it has doesn't really matter,
Exactly. And that same rule of thumb should apply to all drivers.
> but it would make
> sense for an audio device to keep per process state.
It only may make some sense for an audio device given the current poor
design of the audio device interface.
I'm not really sure how a better interface would be designed, but then
again I've not had time to work on such a design either.
However a cloning device solves the problem by very effectively
eliminating the problem completely in the first place thus allowing full
compatability with the existing device interface semantics (from an
application's point of view), and yet allowing multiple applications to
have simultaneous access to the same device. This does seem to require
some kind of multiplexer/mixer inside the kernel though.
Greg A. Woods
+1 416 218-0098 VE3TCP RoboHack <firstname.lastname@example.org>
Planix, Inc. <email@example.com> Secrets of the Weird <firstname.lastname@example.org>