Subject: Re: Time to fix a 25 year old misdesign
To: Lennart Augustsson <lennart@augustsson.net>
From: Darren Reed <darrenr@reed.wattle.id.au>
List: tech-kern
Date: 10/17/2000 22:18:08
In some email I received from Lennart Augustsson, sie wrote:
> Lennart Augustsson wrote:
> 
> > The old UNIX device driver interface is fundamentally broken.  The
> > problem is the following
> >
> >    The driver routine open() is called every time the device
> >    is opened, but close() is only called on the last close.
> 
> In view of the discussion here, I have a modified proposal of a change
> to the kernel driver API.
> 
> Add two new methods incref() and decref().  These methods are called
> whenever the reference count of the device node changes.  I.e., incref()
> will be called on open()/dup()/fork() etc. and decref() will be called on
> close()/exit() etc.  These two methods will be passed the same arguments
> as the open() method, and in addition also the current reference count.
> These two methods are optional, if they are not there the driver will behave
> exactly as before, if they are there they will be called.
> 
> Variations:
>   * Don't call incref() on open() nor decref() on last close().
>   * Use one method, changeref(), that gets an extra argument
>     that tells if what
>   the change is.
> 
> Comments?

Make sure you measure the performance of fork(), etc *before* you do this.

There have been a lot of comments about NetBSD "slowing down" - this will
slow it down and it'd be nice to know "how much" (although I think it'll
just be another drop).  I'm not saying this is a "bad idea" - all good
ideas and new features have a cost.

Darren