Subject: Re: mapping shared memory at a fixed address
To: Rahul Kulkarni <firstname.lastname@example.org>
From: Andrey Petrov <email@example.com>
Date: 02/08/2005 15:02:43
On Tue, Feb 08, 2005 at 11:56:19AM -0800, Rahul Kulkarni wrote:
> The objective is for multiple proocesses to map a
> shared memory segment at the same fixed virtual
> address. What I'm trying to achieve is basically a
> parent process creates a shared memory segment using
> mmap and maps it at some location say abcd. It then
> forks and execs bunch of child processes which need to
> map the same shared memory segment at the same
> location abcd. The reson is due to shared pointers in
> the shared memory ( I agree we can do relative
> pointers, but in this paritcular case I'm not looking
> to do that because of some other constraints). Its not
> just one process trying to map at a given location,
> its is a bunch of processes which need to map at the
> same location.What are the other options here for me?
> 1. A linker script which can add a zero filled region
> to all the executables at a given address range?
> 2. Reserving a range (how?) between the data and the
> stack limit for all the processes?
You can use LD_PRELOAD option of dynamic linker (ls.elf_so).
It will let you mmap segment pretty early so if you choose
your virtual wisely:-) you'll get your chance.