glibc-doc includes a different interpretation for MS_SYNC than is
included in the manpage.

msync.2:
  MS_SYNC asks for an update and waits for completion.

glibc-doc:
  "MS_SYNC requests that the mapping is written to disk, rather than
  just requiring the visibility of changed data to other opened
  objects of that file."

Also, EINVAL is not documented as the (tested) consequence of setting
MS_SYNC|MS_ASYNC.

There seems to be some subtle difference that MS_SYNC makes, but I
don't understand it.  However, it causes stuff to happen that doesn't
when it is not set, and the given description is (at least)
incomplete.  AFAICS msync returns immediately unless MS_ASYNC is set,
and MS_SYNC does something more than just annotating that the call
should not return until the sync is complete, and whatever it does is
also inconsistent with MS_ASYNC, but isn't just the same as the
absence of that flag.

I think the following comment from the kernel sources is the closest
that I've come to understanding:

 * MS_SYNC syncs the entire file - including mappings.

Does MS_SYNC perahps cause changes to the file to be "visible in the
mapped region"?


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to