Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Aug 1997 15:01:23 +0930 (CST)
From:      Michael Smith <msmith@atrad.adelaide.edu.au>
To:        luigi@labinfo.iet.unipi.it (Luigi Rizzo)
Cc:        hackers@FreeBSD.ORG
Subject:   Re: device close behaviour - a question
Message-ID:  <199708010531.PAA03720@genesis.atrad.adelaide.edu.au>
In-Reply-To: <199708010302.FAA06838@labinfo.iet.unipi.it> from Luigi Rizzo at "Aug 1, 97 05:02:11 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Luigi Rizzo stands accused of saying:
> 
> I am having a problem related to the having multiple (actually,
> 2) open descriptors on the same character device. More specifically,
> I notice that only the last close does actually invoke the device
> close routine.

Heh.  This one is tricky.

> >From the code in /sys/miscfs/specfs/spec_vnops.c, function 
> spec_close(), this behaviour seems intentional. But can someone
> explain why this is done and where this is useful ?
> I do not dare to suggest that this be changed since I guess it would
> break many things... or not ?

Think about inheritance of fd's by a child process from the parent.

> In my case, I have implemented the ability of having up to two open
> descriptors on full-duplex audio devices, one for read and one for 
> write. The above behaviour does not let me record that a channel 
> has been freed (this I would have done using the close() call), 
> and complicates life to the driver since it has to guess what is
> happening. 

You cannot ever guarantee any fixed number of openers on a device.

-- 
]] Mike Smith, Software Engineer        msmith@gsoft.com.au             [[
]] Genesis Software                     genesis@gsoft.com.au            [[
]] High-speed data acquisition and      (GSM mobile)     0411-222-496   [[
]] realtime instrument control.         (ph)          +61-8-8267-3493   [[
]] Unix hardware collector.             "Where are your PEZ?" The Tick  [[



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708010531.PAA03720>