mmap/munmap with zero length

Alexander Best alexbestms at math.uni-muenster.de
Sat Jul 4 22:48:48 UTC 2009


i'm wondering why mmap and munmap behave differently when it comes to a length
argument of zero. allocating memory with mmap for a zero length file returns a
valid pointer to the mapped region.

munmap however isn't able to remove a mapping with no length.

wouldn't it be better to either forbid this in mmap or to allow it in munmap?

cheers.
alex


More information about the freebsd-hackers mailing list