wrap mmap in a more sensible way