mmap VS mmap64?

what is the difference?

mmap is using an int for the offset, so it’s impossible to map memory above 2gig (maximum an int can represent). mmap64 use an in 64 so it doesn’t suffer from that limitation.

got it~ thanks

hi,

i have another question regarding this topic:

does the use of mmap64 ensure that the returned address (if first parameter addr is NULL) is also 64 bit aligned?

if not, how can i do this? i need to ensure that the shared memory is mapped starting from a 8 byte aligned address from every process.

thanks for the answer

It always is, even for malloc i believe.

The 64 part in mmap has nothing do do with alligment put rather with the ability to map memory beyond 2G

An mmap allocation will be page alligned. Pages are 4096 bytes, so the data returned is at the very least on a 16 byte boundary.