Using mmap(2) with a hint address
avg at FreeBSD.org
Tue Dec 20 10:10:52 UTC 2011
on 20/12/2011 10:08 Ganael LAPLANCHE said the following:
> Hi folks,
> I am trying to use mmap(2) with a hint address. Unfortunately, this address
> seems to be ignored and I never manage to get the desired one, while it
> seems to be free.
> Using MAP_FIXED, I can get the desired address, but it is overkill (it
> any previous mappings and its use is discouraged, see mmap(2)) and
> should not
> be needed here.
> Am I doing something wrong here ?
Can the following code explain what you are seeing?
* XXX for non-fixed mappings where no hint is provided or
* the hint would fall in the potential heap space,
* place it after the end of the largest possible heap.
* There should really be a pmap call to determine a reasonable
if (addr == 0 ||
(addr >= round_page((vm_offset_t)vms->vm_taddr) &&
addr < round_page((vm_offset_t)vms->vm_daddr +
addr = round_page((vm_offset_t)vms->vm_daddr +
More information about the freebsd-stable