From owner-freebsd-hackers Thu Jul 31 22:32:49 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id WAA29680 for hackers-outgoing; Thu, 31 Jul 1997 22:32:49 -0700 (PDT) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id WAA29666 for ; Thu, 31 Jul 1997 22:32:32 -0700 (PDT) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id PAA03720; Fri, 1 Aug 1997 15:01:24 +0930 (CST) From: Michael Smith Message-Id: <199708010531.PAA03720@genesis.atrad.adelaide.edu.au> Subject: Re: device close behaviour - a question In-Reply-To: <199708010302.FAA06838@labinfo.iet.unipi.it> from Luigi Rizzo at "Aug 1, 97 05:02:11 am" To: luigi@labinfo.iet.unipi.it (Luigi Rizzo) Date: Fri, 1 Aug 1997 15:01:23 +0930 (CST) Cc: hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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 [[