1

The accepted answer to When would one use mmap map_fixed states: "So instead you first make a dummy mapping of the total length needed (the type of this mapping doesn't matter) without MAP_FIXED just to reserve a sufficient range of contiguous addresses at a kernel-assigned location, then you use MAP_FIXED to map over top of parts of this range as needed with the three or more mappings you need to create."

My question is: do the subsequent mmap calls with MAP_FIXED meant to overlay the reserved page-aligned range, need to pass a page-aligned address argument to mmap?

kaylum
  • 13,833
  • 2
  • 22
  • 31

1 Answers1

2

The mmap man page has the info you need (emphasis mine):

MAP_FIXED

Don't interpret addr as a hint: place the mapping at exactly that address. addr must be suitably aligned: for most architectures a multiple of the page size is sufficient; however, some architectures may impose additional restrictions.

Community
  • 1
  • 1
kaylum
  • 13,833
  • 2
  • 22
  • 31