From owner-freebsd-hackers Sat Nov 30 11: 8:51 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4FD3437B401 for ; Sat, 30 Nov 2002 11:08:50 -0800 (PST) Received: from postfix4-1.free.fr (postfix4-1.free.fr [213.228.0.62]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9E79C43E9C for ; Sat, 30 Nov 2002 11:08:49 -0800 (PST) (envelope-from nsouch@free.fr) Received: from armor.fastether (nas-cbv-8-62-147-156-220.dial.proxad.net [62.147.156.220]) by postfix4-1.free.fr (Postfix) with SMTP id A8675D8B5 for ; Sat, 30 Nov 2002 20:08:47 +0100 (CET) Received: (qmail 2213 invoked by uid 1001); 30 Nov 2002 19:18:46 -0000 Date: Sat, 30 Nov 2002 20:18:46 +0100 From: Nicolas Souchu To: Doug Rabson Cc: Nicolas Souchu , freebsd-hackers@freebsd.org Subject: processes private data & vm_mmap Message-ID: <20021130201846.A2089@armor.fastether> References: <20010628182533.B17804@avon.alcove-fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from dfr@nlsystems.com on Thu, Jun 28, 2001 at 07:48:21PM +0100 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 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