From owner-freebsd-hackers Fri Aug 1 19:52:42 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id TAA27336 for hackers-outgoing; Fri, 1 Aug 1997 19:52:42 -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 TAA27331 for ; Fri, 1 Aug 1997 19:52:39 -0700 (PDT) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id MAA08782; Sat, 2 Aug 1997 12:22:18 +0930 (CST) From: Michael Smith Message-Id: <199708020252.MAA08782@genesis.atrad.adelaide.edu.au> Subject: Re: device close behaviour - a question In-Reply-To: <199708011655.JAA03079@biggusdiskus.flyingfox.com> from Jim Shankland at "Aug 1, 97 09:55:15 am" To: jas@flyingfox.com (Jim Shankland) Date: Sat, 2 Aug 1997 12:22:18 +0930 (CST) Cc: luigi@labinfo.iet.unipi.it, msmith@atrad.adelaide.edu.au, 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 Jim Shankland stands accused of saying: > [Luigi Rizzo would like his audio driver to be notified every time > the device is closed, not just on last close.] > > The way I've dealt with a similar situation in the past is to represent > each physical device as an array of minor device numbers, on each of > which the driver enforces an exclusive-open. User-level code must The point I am trying to make here is that you _cannot_ enforce an exclusive open, because the devic driver is not notified under all of the circumstances which result in a new fd being granted. > then iterate over the devices, until an open() call does not return > EBUSY (just like looking for an available pty). Since each "device" > is open at most once, the device_close() routine gets called on > every user-level close() call. This scheme works well if you are at liberty to enforce the behaviour of userland programs. Luigi is faced with remaining compatible with previous versions and also with the Linux interface, which is a fairly crippling requirement in and of itself. -- ]] 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 [[