Subject: Re: dev/audiobell.c proposal
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 01/15/2004 17:56:40
>>> FreeBSD has a flag in the devsw structure to allow the close
>>> function to be called at each close call on the device.
>> Probably, but would it do what you want?  It's entirely possible to
>> have multiple closes for a single open; consider a process that
>> forks.
> It means that the device is very likely to keep state through the
> struct proc pointer it gets in the functions (and indeed, that's
> precisely what NVidia does).

What do they do if a process forks?  (How does the driver hear about
it, to duplicate that state?)

What do they do about multiple cards open in a single process?  What
about multiple opens of a single card?

> Most devices [...], but it would make sense for an audio device to
> keep per process state.

Would it?  What about forking processes?  What about file descriptors
passed thorugh sockets?  What about processes with multiple opens on a
single device?  What about processes with multiple devices open?

The more I hear about this the more it sounds like cloning devices,
only done wrong.

> If we'd go on the in-kernel mixer road, each feeder would have its
> own rate, gain and such.  The device would have to keep track of all
> of this, even though there would be only one audio device behind.

Certainly...but I still think it'd be better to do it with
new-minor-on-open semantics, which is what I think (correctly or
incorrectly) cloning devices basically are.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B