Implement functions used for mmap