Reputation: 23
I use mmap
to map file F to block B, and then I only write one byte of B.
If I call msync() for B with MS_SYNC, does the OS write all the block to F? Or it only writes the one byte modified to F?
Upvotes: 0
Views: 652
Reputation: 2156
What does the man page on your particular system say? If it's not open source, that's about the best you have to go on, unless you have can find more detailed documentation for your UNIX platform.
On at least one system, man msync says:
The msync() system call writes modified whole pages back to the filesystem and updates the file modification time. Only those pages containing addr and len-1 succeeding locations will be examined.
Upvotes: 0
Reputation: 500357
This is OS- and architecture-specific, but most likely only the dirty page will be written to disk.
Upvotes: 1