Subject: Re: Time to fix a 25 year old misdesign
To: None <tech-kern@netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: tech-kern
Date: 10/15/2000 14:10:37
[ On Sunday, October 15, 2000 at 19:36:09 (+0200), Lennart Augustsson wrote: ]
> Subject: Re: Time to fix a 25 year old misdesign
>
> Thinking some more about my proposal I realize that it is flawed.
> The problem is that it is not only the open() system call that generates
> an extra reference to a device vnode, but also for().

Indeed.  I was going to point that out next, but Matt beat me to it!  :-)

> This means that with my scheme there would (potentially) be more
> calls to dev_close() than dev_open(), which is also broken.

Not just fork() but, as Matt says, dup() and FD-passing too.

> This could be fixed by introducing a device method that is called when
> the reference count is increased (e.g. by fork).  But now its starts to
> get unelegant...

Indeed!  :-)

There's also really no need either since with a correct driver design
that separates functionality out logically to separate /dev files
(i.e. with different minor numbers) will eliminate the need for such
uglyness in the driver.

Changing this very fundamental part of the Unix I/O system design would
have potentially far reaching implications that could "break" many more
things than it is intended to fix (thus the elegance of the current
design).

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>