Subject: Re: mapping shared memory at a fixed address
To: Bill Studenmund <>
From: Wolfgang Solfrank <>
List: netbsd-users
Date: 02/08/2005 19:07:53

Sorry for churning in this late, but:

Bill Studenmund wrote:
> On Tue, Feb 08, 2005 at 11:51:10AM -0500, Stephan Uphoff wrote:
>>On Mon, 2005-02-07 at 13:39, Bill Studenmund wrote:
>>>On Fri, Feb 04, 2005 at 04:05:25PM -0800, Rahul Kulkarni wrote:
>>>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..
>>Mhhh .. maybe adding a zero filled section to the executable(s) at a
>>fixed address would work.
>>The executable could then unmap / remap the reserved address range.
>>If this would work it probably needs a linker script from hell ;-).
> The problem is that you'd have to have that linker script link everything 
> around the hole.

I'm not sure what you are trying to achieve here, but mmap will work quite
happily mapping over some area that is already occupied by something else.
Of course there will be problems when you mmap over an area that is used
for something viable (like e.g. libc), so probably you are trying to avoid
this by this linker script dance.  However, there are other ways to guarrantee
that some address space isn't used (like e.g. static linking and mmaping
somewhere between data limit and stack limit).

ws@TooLs.DE                            Wolfgang Solfrank, TooLs GmbH