From owner-freebsd-hackers Fri Aug 1 10:44:16 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id KAA01959 for hackers-outgoing; Fri, 1 Aug 1997 10:44:16 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.50]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id KAA01953 for ; Fri, 1 Aug 1997 10:44:12 -0700 (PDT) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id KAA09486; Fri, 1 Aug 1997 10:40:34 -0700 From: Terry Lambert Message-Id: <199708011740.KAA09486@phaeton.artisoft.com> Subject: Re: device close behaviour - a question To: msmith@atrad.adelaide.edu.au (Michael Smith) Date: Fri, 1 Aug 1997 10:40:34 -0700 (MST) Cc: luigi@labinfo.iet.unipi.it, hackers@FreeBSD.ORG In-Reply-To: <199708010531.PAA03720@genesis.atrad.adelaide.edu.au> from "Michael Smith" at Aug 1, 97 03:01:23 pm X-Mailer: ELM [version 2.4 PL24] 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 > > 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. Poul-Henning was talking about this before on the -current list. In general, I believe everyone agreed that it was desirable to differentiate between "close" and "last close" to provide for "per open instance" private data on devices. There is an issue on open, as well, since a device may be instanced once, but have multiple references created for it (Mike's inheritance of fd's on fork() or on exec() without the close-on-exec flag set via fcntl() is one example of this). The issue is that there is not a semantic seperation between reference instance vs. device instance at open time, so a close differentiation is less than useful. Both corrections would need to occur simultaneously for either one to be useful alone. > You cannot ever guarantee any fixed number of openers on a device. O_EXCL or function equivalent. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.