Subject: Re: mapping shared memory at a fixed address
To: Rahul Kulkarni <firstname.lastname@example.org>
From: Bill Studenmund <email@example.com>
Date: 02/07/2005 10:39:18
Content-Type: text/plain; charset=us-ascii
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
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=20
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 -=20
(intptr_t)MapAddress. Then in the recipient just add the stored or passed=
integer to the local map address.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
-----END PGP SIGNATURE-----