Fix leaks and test for getpagesize() returning == -1
- close file descriptors after use.
- Always munmap memory regions after mmap'ing them.
- Make sure getpagesize() returns a value greater than 0 and use a cached value instead of always calling getpagesize(3).
MFC after: 2 weeks
Reported by: Coverity
CID: 1331374-1331377, 1331653-1331662
Sponsored by: EMC / Isilon Storage Division