Subject: Re: mapping shared memory at a fixed address
To: Bill Studenmund <wrstuden@netbsd.org>
From: Rahul Kulkarni <crypto_rahul@yahoo.com>
List: tech-kern
Date: 02/07/2005 11:43:36
I understand you could do relative pointers..
But I think it still might be possible with some VM
changes(hacks) to reserve a "virtual address region"
in all address spaces, so as to prevent something else
to map at that address in the first place, such that
mmap always maps at the same requested address
successfully?
thanks, Rahul
--- Bill Studenmund <wrstuden@netbsd.org> wrote:
> On Fri, Feb 04, 2005 at 04:05:25PM -0800, Rahul
> Kulkarni wrote:
> > Wondering if anyone can give some pointers on how
> to
> > make mmap map a shared memory segment at a
> specified
> > address always, in different address spaces.
> MAP_FIXED
> > with a specified address works but is not
> gauranteed.
> > In other words, how can I "reserve" the same
> virtual
> > address in different address spaces to map to the
> same
> > segment..
>
> You can't.
>
> Why do you need to?
>
> The problem is that if something else already is
> mapped at the address you
> want, the new mmap won't work. The only way you
> could get around that was
> if you mapped the area and then had the process fork
> into a lot of
> children. However the children could not exec..
>
> If you want to store (or pass) pointers to things in
> the area, just store
> or pass relative pointers. Pass (intptr_t)ThePointer
> -
> (intptr_t)MapAddress. Then in the recipient just add
> the stored or passed
> integer to the local map address.
>
> Take care,
>
> Bill
>
> ATTACHMENT part 2 application/pgp-signature
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail