Subject: Re: multiple cdev open/close
To: Jiri Slaby <jirislaby@gmail.com>
From: Quentin Garnier <cube@cubidou.net>
List: tech-kern
Date: 09/04/2006 11:26:57
--pnDjx0H/VpusRTEI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Sep 04, 2006 at 11:20:45AM +0159, Jiri Slaby wrote:
> Hello,
>=20
> I have netbsd cdev driver. I do multiple opens (more instances) on it, is=
=20
> there any way to get know about each close of these instances?
>=20
> 'A' process does:
> open
> ioctl(START_IT) + others
> for (;;) {
> poll
> ioctl(LOCK_IT)
> read it by mmap
> ioctl(UNLOCK_IT)
> }
>=20
> ^C, so kernel calls close for it and releases A process' resources.
>=20
> If there is also process B, which does the very same thing, for first=20
> process killed there is no close call and kernel turns into ddb. I do nee=
d=20
> to know about all closes -- is there such a way?

Yes, make the device clonable, like e.g. tap(4) and bpf(4).

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.

--pnDjx0H/VpusRTEI
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iQEVAwUBRPvxYdgoQloHrPnoAQJzwggAizOtAsYMYmAcPUzDDFFWhsUgBZfBaB+k
FoC2AjewVmNF1wev7WPEdw/IG8xG2OEbSWdUL4VJAE2PafJ3RX31kgFIuzj/5BG7
XzaFepewY1gs8F+BWjL8bzNJ68uImrqqXmD227EqEgXRYr0bSnqOSqLeVvoQYexp
fek9B+mWlEIeuxUGpJ+23AdOrT4zB1HgGfZP46oy6rVP6SmGHh5z3LxozYTyCPAo
TdPQVxkvMW2NTehAHuz82v/rDarNUIqxrvIgLxOhulz8EoxCDvIv1LDwy91/H3kh
MFDQKecKuaxT7ddfuoGnlv8L4070JIvKxLHlAgtLbK93UobzvuNmWg==
=kCcY
-----END PGP SIGNATURE-----

--pnDjx0H/VpusRTEI--