The Open Group standard says that munmap should be called with a page aligned address, but there doesn't seem to be any requirement that mmap should be returning a page aligned address. Is this something you need to handle when you're writing portable code?
mmap will only map whole pages, and can thus only return a page boundary. It's in the short description:
mmap - map pages of memory
(emphasis mine)
mmap documentation does mention this requirement, although in an off-handed manner. on my mac, for example:
[EINVAL] The offset argument was not page-aligned based on the
page size as returned by getpagesize(3).
http://pubs.opengroup.org/onlinepubs/009695399/functions/mmap.html also says
[EINVAL] The addr argument (if MAP_FIXED was specified) or off is not a multiple of the page size as returned by sysconf(), or is considered invalid by the implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With