In mmap() manpage:
Its prototype is:
void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
and description:
The mmap() function asks to map 'length' bytes starting at offset 'offset'
from the file (or other object) specified by the file descriptor fd into
memory, preferably at address 'start'.
Sepcifically, for the last argument:
'offset' should be a multiple of the page size as returned by getpagesize(2).
From what I practised, offset
MUST be a multiple of the page size, for example, 4096 on my Linux, otherwise, mmap() would return Invalid argument
, offset
is for file offset, why it must be multiple of virtual memory system's page size?
Thanks,