VFS: Sync on unmap
Vicki Pfau vi@endrift.com
Tue, 11 Aug 2020 23:24:44 -0700
1 files changed,
5 insertions(+),
0 deletions(-)
jump to
M
src/util/vfs/vfs-fd.c
→
src/util/vfs/vfs-fd.c
@@ -137,6 +137,7 @@ }
static void _vfdUnmap(struct VFile* vf, void* memory, size_t size) { UNUSED(vf); + msync(memory, size, MS_SYNC); munmap(memory, size); } #else@@ -167,6 +168,7 @@
static void _vfdUnmap(struct VFile* vf, void* memory, size_t size) { UNUSED(size); struct VFileFD* vfd = (struct VFileFD*) vf; + FlushViewOfFile(buffer, size); size_t i; for (i = 0; i < HandleMappingListSize(&vfd->handles); ++i) { if (HandleMappingListGetPointer(&vfd->handles, i)->mapping == memory) {@@ -214,6 +216,9 @@ SYSTEMTIME st;
GetSystemTime(&st); SystemTimeToFileTime(&st, &ft); SetFileTime(h, NULL, &ft, &ft); + if (buffer && size) { + FlushViewOfFile(buffer, size); + } return FlushFileBuffers(h); #endif }