edsrzf / mmap-go

A portable mmap package for Go
BSD 3-Clause "New" or "Revised" License
938 stars 129 forks source link

some question about the function of MapRegion #20

Closed planktonzp closed 2 years ago

planktonzp commented 5 years ago

why the offset must be a multiple of the system's page size? I'm a fresher ,maybe the question is stupid but if you can gave me a explanation I'll be very grateful. Have a nice day

edsrzf commented 2 years ago

This is a requirement for many POSIX operating systems. See: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html

Most implementations require that off and addr are multiples of the page size as returned by sysconf().