This is the mail archive of the
mailing list for the Cygwin project.
Re: mmap and MAP_FIXED
- From: Evgeny Stambulchik <evgeny at stambulchik dot net>
- To: cygwin at cygwin dot com
- Date: Fri, 25 Feb 2005 15:37:43 +0200
- Subject: Re: mmap and MAP_FIXED
Corinna Vinschen wrote:
You shouldn't just use some arbitrary address and
use MAP_FIXED with it, otherwise you're making invaild assumptions
about the memory layout of your machine/os/application.
I know. It was just a test code to demo this 64K strangeness. In
reality, I use addresses which have been previously returned by mmap
The reason that MAP_FAILED only works on 64K boundaries so far is,
that I didn't handle this case.
I expected something like this ;-)
Usually there are not many good reasons to use MAP_FIXED.
I know. Those good ones are memory debuggers/custom allocators. Quoting
"On the other hand, if the program specifies a fixed address mapping
(which requires some implementation knowledge to determine a suitable
address, if the function is supported at all), then the program is
presumed to be successfully managing its own address space and should be
trusted when it asks to map over existing data structures."
Which is exactly my case. I'm talking about libundo, which manages
memory snapshotting: ftp://plasma-gate.weizmann.ac.il/pub/libundo/.
However, I've checked in a patch which
tries to handle MAP_FIXED on 4K boundaries, but only in the anonymous
Great! I'll give it a try once a new cygdll snapshot build is available.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html