Depending on the flags argument, the msync(3) call writes to
storage all modified pages over the range addr to
addr+len or invalidates the existing copies of those
pages so that future references to the page come from permanent
storage. The flags argument can be one of:
MS_ASYNC
Write current memory contents asynchronously. After this call,
all reads can read any writes made to the memory region before the
call, and the call returns after scheduling the write.
MS_SYNC
Write current memory contents synchronously. After this call,
all reads can read any writes made to the memory region before the
call, and the call does not return until the write is
completed.
MS_INVALIDATE
Invalidate existing page mappings. Essentially this makes the
memory mapping look like the last-saved state of the file, rather
than the other way around. The memory region will contain all
writes made to the mapped portion of the file before the call.