Subject: Re: Time to fix a 25 year old misdesign
To: Lennart Augustsson <>
From: Matt Thomas <>
List: tech-kern
Date: 10/15/2000 10:57:46
At 12:12 PM 10/15/2000 +0200, 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.
>This principle makes some drivers a little easier to write (I remember
>thinking that this was the right way when I first saw it exactly 20
>years ago), but it makes implementing certain functionality
>How should it be fixed?  Well, the only% way I can see is to change
>when the close() routine is called for character device drivers.
>Doing that would be a huge amount of work, so instead I suggest that
>we add a routine to the struct cdevsw.  This routine will have the
>same type as the close() routine, but will be called on every close().
>If left out, it will not be called.  This way all old drivers can
>remain intact, and only those that require the new functionality need
>to know about it.

Doesn't quite work.  You also need a call that gets called on 
or your open counts are going to be screwed.

Matt Thomas               Internet:
3am Software Foundry      WWW URL:
Cupertino, CA             Disclaimer: I avow all knowledge of this message