mmap functions to common code