[Groonga-commit] groonga/groonga at 6643603 [master] io windows: ensure flushing on unmap

アーカイブの一覧に戻る
Kouhei Sutou null+****@clear*****
Mon Nov 5 10:05:12 JST 2018


Kouhei Sutou	2018-11-05 10:05:12 +0900 (Mon, 05 Nov 2018)

  Revision: 66436031844b9d8754fb10043df28bbe762ce66d
  https://github.com/groonga/groonga/commit/66436031844b9d8754fb10043df28bbe762ce66d

  Message:
    io windows: ensure flushing on unmap

  Modified files:
    lib/io.c

  Modified: lib/io.c (+14 -2)
===================================================================
--- lib/io.c    2018-11-02 18:41:26 +0900 (6be59c6a6)
+++ lib/io.c    2018-11-05 10:05:12 +0900 (280a483ad)
@@ -1631,6 +1631,11 @@ grn_munmap_v1(grn_ctx *ctx, grn_ctx *owner_ctx, HANDLE *fmo, fileinfo *fi,
   }
 
   if (*fmo) {
+    if (!FlushViewOfFile(start, length)) {
+      SERR("FlushViewOfFile(<%p>, <%" GRN_FMT_SIZE ">) failed on unmap",
+           start, length);
+      r = -1;
+    }
     if (UnmapViewOfFile(start)) {
       mmap_size -= length;
     } else {
@@ -1722,14 +1727,21 @@ grn_inline static int
 grn_munmap_v0(grn_ctx *ctx, grn_ctx *owner_ctx, fileinfo *fi, void *start,
               size_t length)
 {
+  int r = 0;
+
   if (!fi) {
     GRN_FREE(start);
     return 0;
   }
 
+  if (!FlushViewOfFile(start, length)) {
+    SERR("FlushViewOfFile(<%p>, <%" GRN_FMT_SIZE ">) failed on unmap",
+         start, length);
+    r = -1;
+  }
   if (UnmapViewOfFile(start)) {
     mmap_size -= length;
-    return 0;
+    return r;
   } else {
     SERR("UnmapViewOfFile(%p,%" GRN_FMT_SIZE ") failed <%" GRN_FMT_SIZE ">",
          start, length, mmap_size);
@@ -1977,7 +1989,7 @@ grn_msync(grn_ctx *ctx, fileinfo *fi, void *start, size_t length)
 
   succeeded = FlushViewOfFile(start, length);
   if (!succeeded) {
-    SERR("FlushViewOfFile(<%p>, <%" GRN_FMT_SIZE ">) failed",
+    SERR("FlushViewOfFile(<%p>, <%" GRN_FMT_SIZE ">) failed on sync",
          start, length);
     return -1;
   }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20181105/c17a32f4/attachment-0001.html>


More information about the Groonga-commit mailing list
アーカイブの一覧に戻る