Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Nov 2002 20:18:46 +0100
From:      Nicolas Souchu <nsouch@free.fr>
To:        Doug Rabson <dfr@nlsystems.com>
Cc:        Nicolas Souchu <nsouch@fr.alcove.com>, freebsd-hackers@freebsd.org
Subject:   processes private data & vm_mmap
Message-ID:  <20021130201846.A2089@armor.fastether>
In-Reply-To: <Pine.BSF.4.33.0106281944210.866-100000@herring.nlsystems.com>; from dfr@nlsystems.com on Thu, Jun 28, 2001 at 07:48:21PM %2B0100
References:  <20010628182533.B17804@avon.alcove-fr> <Pine.BSF.4.33.0106281944210.866-100000@herring.nlsystems.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 28, 2001 at 07:48:21PM +0100, Doug Rabson wrote:
> On Thu, 28 Jun 2001, Nicolas Souchu wrote:
> 
> > 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?
> 
> The only way I know of to do this is to get a new struct file with
> falloc() and install your own fileops. You can then set p->p_dupfd to the
> new file descriptor and return ENXIO. The caller will magically use the
> new struct file. For an example, see streamsopen() in
> sys/dev/streams/streams.c.

I'm back on the subject 1.5 years later :)

Apparently, falloc does the job for typical write/read operations. But I want
to mmap a char device with per-process data. I mean during open of the char device,
some process dependent data is attached to the vnode then I want to mmap.
Currently, cdevsw mmap is only device (dev_t) oriented without any file (vnode)
consideration. Even the thread is not passed to the d_mmap routine.

I'm porting code from Linux which has per-process data attached to files.

Nicholas

PS: all this is for http://www.freebsd.org/~nsouch/ggiport.html
    KGI/FreeBSD project.

-- 
Nicholas Souchu - nsouch@free.fr - nsouch@FreeBSD.org

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?20021130201846.A2089>