File changes after mmap in OS X / iOS
What happens if, after displaying the memory map with mmap
and flag, MAP_PRIVATE
I make changes to the base file in the same process? Will memory mmap
change the changes?
On Linux, the man page says:
MAP_PRIVATE: Create a private copy-on-write mapping. Map updates are not displayed to other processes that map to the same file and are not carried over to the main file. It is not specified whether changes to the file are reflected after calling mmap () in the rendered area.
So on Linux the answer is "unspecified".
However, on Mac OS X it only says:
MAP_PRIVATE: changes are private (copy-to-write).
I made a quick example tool that shows that making changes doesn't affect private mappings. But there is no other proof of this.
source to share
No one has answered this question yet
Check out similar questions: