add a HAVE_MMAP check, cleanups.