From owner-freebsd-hackers Thu Jul 31 21:52:05 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id VAA26872 for hackers-outgoing; Thu, 31 Jul 1997 21:52:05 -0700 (PDT) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id VAA26736 for ; Thu, 31 Jul 1997 21:50:32 -0700 (PDT) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id FAA06838; Fri, 1 Aug 1997 05:02:11 +0200 From: Luigi Rizzo Message-Id: <199708010302.FAA06838@labinfo.iet.unipi.it> Subject: device close behaviour - a question To: hackers@freebsd.org Date: Fri, 1 Aug 1997 05:02:11 +0200 (MET DST) X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi, 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. >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 ? 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. I do have locks on concurrent operations of the same type, and have implemented some hacks to (more or less) control that proper device usage is done. However, these are hacks, and the lack of information can cause suboptimal behaviours. As an example, due to the missing close I cannot decide to stop a DMA read since I don't know if the reading process has gone. Cheers Luigi -----------------------------+-------------------------------------- Luigi Rizzo | Dip. di Ingegneria dell'Informazione email: luigi@iet.unipi.it | Universita' di Pisa tel: +39-50-568533 | via Diotisalvi 2, 56126 PISA (Italy) fax: +39-50-568522 | http://www.iet.unipi.it/~luigi/ _____________________________|______________________________________