From owner-freebsd-hackers Tue Nov 7 17:57:12 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from iguana.aciri.org (iguana.aciri.org [192.150.187.36]) by hub.freebsd.org (Postfix) with ESMTP id 78F2E37B479 for ; Tue, 7 Nov 2000 17:57:09 -0800 (PST) Received: (from rizzo@localhost) by iguana.aciri.org (8.9.3/8.9.3) id RAA00555; Tue, 7 Nov 2000 17:57:02 -0800 (PST) (envelope-from rizzo) From: Luigi Rizzo Message-Id: <200011080157.RAA00555@iguana.aciri.org> Subject: Re: close call in a device ? In-Reply-To: <3A08ACB5.FD22CE8@dvart.com> from bruno schwander at "Nov 7, 2000 5:30:29 pm" To: bschwand@dvart.com (bruno schwander) Date: Tue, 7 Nov 2000 17:57:02 -0800 (PST) Cc: freebsd-hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL43 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > when a process closes the device, I do not get a "close" call for each > process closing the device. I instead get a close only on the last > process closing the device. the reason for this is that you might have a process fork() after it has opened the device, and you do not want to get to the device all close calls from all processes generated by the original one, but really only the last instance. The thing is, i think your model (allocating per-user resources on open) is wrong. It cannot protect you from a process forking and then having two instances using the same device. If you want multiple instances of the device, one option could be to use the minor number and really create multiple instances of the device, and open them in exclusive way so you know that there can be only one open per device (you should scan available devices in a similar way as the one is used for scanning pty's). cheers luigi ----------------------------------+----------------------------------------- Luigi RIZZO, luigi@iet.unipi.it . ACIRI/ICSI (on leave from Univ. di Pisa) http://www.iet.unipi.it/~luigi/ . 1947 Center St, Berkeley CA 94704 Phone: (510) 666 2927 ----------------------------------+----------------------------------------- > This is a problem since I need to allocate/free resources for each > process accessing the device, at the time a process closes the device. > > Is there a way to make sure my driver gets all "close" calls ? > > I could possibly get around this by using timeouts, but the > unpredictability of the accessing processes may make this very difficult > and suboptimal, so getting the "close" calls would be way better > > Thank you all for any information on this > > bruno > > -- > > ########################################################################### > > Bruno Schwander > Senior Software Engineer > > Worldgate Communications, Inc > email: bschwand@dvart.com > > ############################################################################ > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message