Mickey
Mickey

Reputation: 490

The MAP_FIXED constant of mmap sys_call

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

Answers (1)

Variable Length Coder
Variable Length Coder

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

Related Questions