Subject: Re: Time to fix a 25 year old misdesign
To: None <lennart@augustsson.net, tech-kern@netbsd.org>
From: Chris Torek <torek@BSDI.COM>
List: tech-kern
Date: 10/22/2000 05:37:14
I tried to do this once.  The dup() call defeats it:

	open("/dev/foo", O_RDWR) => 3
	dup(3) => 4
	close(4) => ok
	close(3) => ok

Two close calls, but only one open.  Hmm.

If you had a new entry point such as "changeref" you could call
it with +1 on open-or-dup and -1 on close, perhaps.

Other existing "fancy" drivers (equivalent to audio read+write)
tend to use ad-hoc solutions, such as multiple minor devices, or
the /dev/console trick of calling open() with S_IFLNK as the "mode".

Chris