From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 9 15:48:29 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E202106564A for ; Fri, 9 Dec 2011 15:48:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 555BF8FC17 for ; Fri, 9 Dec 2011 15:48:29 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id E7EB246B0D; Fri, 9 Dec 2011 10:48:28 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 78725B95F; Fri, 9 Dec 2011 10:48:28 -0500 (EST) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Fri, 9 Dec 2011 09:45:56 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <11076.1322906459@critter.freebsd.dk> <0011FD6A-E29D-4F67-913C-897BA1B2F56F@gmail.com> In-Reply-To: <0011FD6A-E29D-4F67-913C-897BA1B2F56F@gmail.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201112090945.56414.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 09 Dec 2011 10:48:28 -0500 (EST) Cc: Filippo Sironi , Poul-Henning Kamp Subject: Re: mmap implementation for cdev X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 15:48:29 -0000 On Saturday, December 03, 2011 5:37:01 am Filippo Sironi wrote: > I need to access the memory both from user space and kernel space, I cannot do that (simply) with an mmap or thread-specific storage if I recall correctly. You could allocate a dedicated VM object for each thread's information and populate it with a single page. You could then return that from a csw->d_mmap_single() routine. You could also use some routines I'm about to add for the shm_open() API that let you easily map shm_open() objects into the kernel where threads create a shm object in userland and pass the fd into the kernel to let the kernel map it. > On 03/dic/2011, at 11.00, Poul-Henning Kamp wrote: > > > In message , Filippo Sironi wri > > tes: > > > > Why don't you just use mmap(2) ? I couldn't see anything you > > couldn't do with it. > > > > There's also support in pthread for thread specific storage, which > > should be your first choice. > > > > > > -- > > Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 > > phk@FreeBSD.ORG | TCP/IP since RFC 956 > > FreeBSD committer | BSD since 4.3-tahoe > > Never attribute to malice what can adequately be explained by incompetence. > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > -- John Baldwin