Subject: Re: audio open()/close() inconsistency
To: Aymeric Vincent <vincent@labri.fr>
From: Quentin Garnier <cube@cubidou.net>
List: tech-kern
Date: 09/16/2007 18:57:54
--v3PO+W4hh3dRkCny
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Sep 16, 2007 at 06:52:04PM +0200, Aymeric Vincent wrote:
> Aymeric Vincent <vincent@labri.fr> writes:
>=20
> > Quentin Garnier <cube@cubidou.net> writes:
> >
> >> While I don't deny there might be a bug, your analysis is incorrect:
> >> the close() function from the cdevsw structure is called only once, wh=
en
> >> there is no remaining file descriptor using the device.
> >
> > Ah, you're right. Even if the device is opened once on /dev/audio0 and
> > once on /dev/sound0?
>=20
> Eh, actually, I think close() will be called anyway. I'm speaking of
> two completely different processes: they don't have file descriptors
> pointing to the same file description.
>=20
> Close() has to be called when either process quits otherwise recording
> or playing would still be active, although playing silence or dropping
> recorded data.

I'm not saying anything about what _should_ happen.  The fact is that
specfs code only calls the close() function for a given dev_t when the
device is actually meant to fall unused.

Granted, audio0 and sound0 are different nodes from specfs's POV.

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"You could have made it, spitting out benchmarks
Owe it to yourself not to fail"
Amplifico, Spitting Out Benchmarks, Hometakes Vol. 2, 2005.

--v3PO+W4hh3dRkCny
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (NetBSD)

iQEVAwUBRu1gktgoQloHrPnoAQLLrwgAtijSohGe5FKszfH0bC1eVEz76sngX92z
RdNTJZgtp+usJ8F2AjNas/idKW+HLFxknii87ANs+vA2UE6cTDsck7RGptQVKRwr
n7GnIU7kYuGUgfsKeFV3ppd3o5f6nocst9VwUy+fr0Ar1WMyiQsGPJRUzllpgQUI
kHIMoOuXhs2h9SR2Axt5uJ8xbcF2blHU4XhwgXu9W2C1ykYNqarO1hgdSyx+YxXO
BG+wZshzQybizRrYbwsOF06DfDfJimZAcsduxuPm6Aj1GqcBF+z9LCEK4sklLRmt
Knp0x6K7AmMaI8bRx8ahKr1hX1OTV5fyjcxRKL83dKgwZk1t3boSOA==
=XcMo
-----END PGP SIGNATURE-----

--v3PO+W4hh3dRkCny--