This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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 (without MAP_FIXED).

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 POSIX (
"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:

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:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]