https://bugs.winehq.org/show_bug.cgi?id=56951
Thomas Munro thomas.munro@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |thomas.munro@gmail.com
--- Comment #5 from Thomas Munro thomas.munro@gmail.com --- Hi,
I think a real implementation of NtFlushBuffersFileEx() probably just needs to take the existing body of NtFlushBuffersFile(), but where it does[1]:
if (fsync(fd)) ret = errno_to_status( errno );
... it should use fdatasync() instead, if the Flags argument contains FLUSH_FLAGS_FILE_DATA_SYNC_ONLY. One small complication is that macOS lacks fdatasync(). Well, it has the symbol and it works, but there is no declaration in <unistd.h> for reasons unknown to open-source-hacker-kind, so you'd need some compile-time conditional workaround (either supply the missing declaration like PostgreSQL does or fall back to the fsync() path, if macOS detected either by name or, better, by configure probe for the declaration). Every other Unix on your target list has it (it's from POSIX/SUSv2).
Then NtFlushBuffersFile() becomes just a call to NtFlushBuffersFileEx() with zero flags.
(I'm the author of that PostgreSQL change. Unfortunately I'm not in a position to submit a WINE patch for bureaucratic reasons, but I hope the above helps. I would like to be able to test cross-builds of PostgreSQL on WINE myself! This isn't the only obstacle to that, but it is the first one that comes up, ie early in program startup.)
[1] https://github.com/wine-mirror/wine/blob/88a28aa5757ae74d9997b470d70216f1097...