From 9756f79f044767052280bcc7d7d1225b1f326698 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Wed, 19 Oct 2016 13:52:51 -0700 Subject: [PATCH] VFS: Call msync when syncing mapped data --- CHANGES | 1 + src/util/vfs/vfs-fd.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 15d2c24c6..274125f91 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,7 @@ Misc: - GBA Video: Clean up unused timers - Test: Add a basic test suite - GBA Video: Allow multiple handles into the same tile cache + - VFS: Call msync when syncing mapped data 0.5.1: (2016-10-05) Bugfixes: diff --git a/src/util/vfs/vfs-fd.c b/src/util/vfs/vfs-fd.c index 5b96f58b5..2b0f418c9 100644 --- a/src/util/vfs/vfs-fd.c +++ b/src/util/vfs/vfs-fd.c @@ -167,6 +167,9 @@ static bool _vfdSync(struct VFile* vf, const void* buffer, size_t size) { struct VFileFD* vfd = (struct VFileFD*) vf; #ifndef _WIN32 futimes(vfd->fd, NULL); + if (buffer && size) { + return msync(buffer, size, MS_SYNC) == 0; + } return fsync(vfd->fd) == 0; #else HANDLE h = (HANDLE) _get_osfhandle(vfd->fd);