From owner-freebsd-hackers Fri Jun 29 0:29:32 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from snipe.mail.pas.earthlink.net (snipe.mail.pas.earthlink.net [207.217.120.62]) by hub.freebsd.org (Postfix) with ESMTP id E106637B405 for ; Fri, 29 Jun 2001 00:29:29 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from mindspring.com (dialup-209.245.136.253.Dial1.SanJose1.Level3.net [209.245.136.253]) by snipe.mail.pas.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id AAA02939; Fri, 29 Jun 2001 00:29:10 -0700 (PDT) Message-ID: <3B3C2E66.AD9B26F2@mindspring.com> Date: Fri, 29 Jun 2001 00:29:42 -0700 From: Terry Lambert Reply-To: tlambert2@mindspring.com X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Drew Eckhardt Cc: Nicolas Souchu , freebsd-hackers@FreeBSD.ORG Subject: Re: processes private data References: <200106281753.f5SHrqT05567@revolt.poohsticks.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Drew Eckhardt wrote: > > In message <20010628182533.B17804@avon.alcove-fr>, nsouch@fr.alcove.com writes: > >Hi folks, > > > >I have a char driver that must be opened by more than one > >process. The minor index is not sufficient for this. Is > >there any process private data (void *) in the devfs > >structure (or the opposite) I could point to with the minor > >index of my device? > > No. You need a cloning device. You would need to modify the specfs code considerably, add a void * private device insteance data structure that could be used each time the device was referenced, and return different vnodes. The first thing in your way will end up being the ihash cache for FFS-hosted device nodes, struct fileops, for lack of a reflexive entry point for open/close, and then specfs itself. There is a discussion about how you might approach doing this in the devfs case, with some good input from phk; check the mailing list archives for -arch. At the present time, though, the code doesn't support it directly. > You want to split your minor number into separate unit > and instance parts, and allow each instance to be only > opened once (return EBUSY). A quick fix is to continue > selecting the softc structure exclusively based on unit > number and to hang the necessary per instance data off that. Actually, this probably can't work. And this approach (different minor numbers) can't work for binary code that doesn't expect that behaviour (e.g. this is why you can only run one instance of vmware at a time on FreeBSD, but can run multiple instances at a time under Linux: the Linux device driver has per open instance data that is is used by the driver to distinguish the instance of the program that has it open, and then acts accordingly based on that). -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message