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.

+3
linux memory darwin mmap macos


source to share


No one has answered this question yet

Check out similar questions:

4800
How to find all files containing specific text in Linux?
1773
How to symbolize a file in Linux?
1101
How to chmod a folder and all its subfolders and files in Linux Ubuntu Terminal?
18
How to transfer file access using mmap ()
3
How can I check if a memory area is being mapped to a file?
2
mmap writes to a file on disk (synchronous / asynchronous)
1
resizing a file with ftruncate () after mmap ()
0
Split calls to mmap using MAP_SHARED use the same shared memory area?
0
How MAP_PRIVATE descriptor changes to base file after mmap () call
0
Request for MAP_PRIVATE



All Articles
Loading...
X
Show
Funny
Dev
Pics