Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2013-01-18 13:35:05 +0400
committerCorinna Vinschen <corinna@vinschen.de>2013-01-18 13:35:05 +0400
commitb31aa3904ccea9c6e66da861f8d44a266f69a043 (patch)
treeda7c3e7c6861554a48b6fe0904b4509b836c804b
parentc5eb7a4971c9f6d93cf9d03c7cbaf1d9144afdf0 (diff)
* mmap.cc (handler_disk_file::msync): Add call to FlushFileBuffers
to implement MS_SYNC.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/mmap.cc9
2 files changed, 13 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 9920d98e4..f75aa354c 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-18 Christopher Faylor <me.cygwin2013@cgf.cx>
+
+ * mmap.cc (handler_disk_file::msync): Add call to FlushFileBuffers
+ to implement MS_SYNC.
+
2013-01-17 Christopher Faylor <me.cygwin2013@cgf.cx>
* mmap.cc (handler_disk_file::msync): Retry up to 99 times if
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index 0ede7e6ab..da89d9d81 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -1664,7 +1664,14 @@ fhandler_disk_file::msync (HANDLE h, caddr_t addr, size_t len, int flags)
cygwin list. So retry 99 times and hope we get lucky. */
for (int i = 0; i < retry; i++)
if (FlushViewOfFile (addr, len))
- return 0;
+ {
+ /* FlushViewOfFile just triggers the action and returns immediately,
+ so it's equivalent to MS_ASYNC. MS_SYNC requires another call to
+ FlushFileBuffers. */
+ if (flags & MS_SYNC)
+ FlushFileBuffers (h);
+ return 0;
+ }
else if (GetLastError () != ERROR_LOCK_VIOLATION)
break;
else if (i < (retry - 1))