From owner-freebsd-hackers Tue Nov 7 23:37: 0 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 DC6D937B4C5 for ; Tue, 7 Nov 2000 23:36:56 -0800 (PST) Received: (from rizzo@localhost) by iguana.aciri.org (8.9.3/8.9.3) id XAA02080; Tue, 7 Nov 2000 23:36:55 -0800 (PST) (envelope-from rizzo) From: Luigi Rizzo Message-Id: <200011080736.XAA02080@iguana.aciri.org> Subject: Re: close call in a device ? In-Reply-To: <3A08BDBD.575A6AA4@dvart.com> from bruno schwander at "Nov 7, 2000 6:43: 9 pm" To: bschwand@dvart.com (bruno schwander) Date: Tue, 7 Nov 2000 23:36:55 -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 > Hi, > > The reason I am doing this, is precisely because I need to virtualize accesses > from several processes to _one_ _predefined_ device. I have no control over that > device name from the client process point of view, so I can not have multiple > devices. I pretty much need to be able to lie to the process, telling it that it > has full control of the device it wants, and actually allow other processes to > open and use the device in the same way at the same time. you could do something like this: + open allocates a descriptor which stores the PID of the process requesting access to the "device" + each I/O operation uses the descriptor matching the PID passed to the read/write/ioctl + you could implement an ioctl() to dispose the storage, a "well behaved" process would have to invoke this ioctl before terminating; + and a timeout as you suggested could be used to purge entries that have been idle for some time, or you could also purge them basing on usage patterns assumning there are clearly identifiable ones. > Did I miss something in your suggestion ? Or were you suggesting that I can > create same name device entries, differing only by their minor number ? But then you cannot use the same name unless the entries are in different directories. My suggestion was to use /dev/foo.00 /dev/foo.01 /dev/foo.02 and so on. 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 ----------------------------------+----------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message