1

File changes after a mmap in OS X / iOS

view story
linux-howto

http://stackoverflow.com – What happens if, after I memory-map a file using mmap and flag MAP_PRIVATE, I make changes to the underlying file while in the same process? Will the mmap memory pick up the changes? In Linux, the man page says: MAP_PRIVATE: Create a private copy-on-write mapping. Updates to the mapping are not visible to other processes mapping the same file, and are not carried through to the underlying file. It is unspecified whether changes made to the file after the mmap() call are visible in the mapped region. So in Linux, the answer is "unspecified". In Mac OS X however it only says: MAP_PRI (HowTos)