Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jun 2001 00:29:42 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Drew Eckhardt <drew@PoohSticks.ORG>
Cc:        Nicolas Souchu <nsouch@fr.alcove.com>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: processes private data
Message-ID:  <3B3C2E66.AD9B26F2@mindspring.com>
References:  <200106281753.f5SHrqT05567@revolt.poohsticks.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B3C2E66.AD9B26F2>