Reputation: 490
What does the constant MAP_FIXED do for mmap?
I've read it in the manual but still don't understand its purpose and for which cases it's good.
Upvotes: 0
Views: 138
Reputation: 8116
MAP_FIXED specifies that the mmap'd memory should be at the virtual address passed as the first argument to mmap()
. This has very limited usage in modern user programs and in fact some operating systems simply return an error if MAP_FIXED is specified.
One possible use for MAP_FIXED is when implementing a memory allocator (such as malloc()), mmap() may be used to carve out the heap memory.
Upvotes: 3