mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:54:14 +08:00
mdbx: clarify mdbx_filesync().
Change-Id: I39029a52fd44c81901aff6114a5c58a62b92098b
This commit is contained in:
parent
1f7f3af16c
commit
1b09605a06
@ -621,9 +621,9 @@ int mdbx_write(mdbx_filehandle_t fd, const void *buf, size_t bytes) {
|
||||
}
|
||||
}
|
||||
|
||||
int mdbx_filesync(mdbx_filehandle_t fd, bool fullsync) {
|
||||
int mdbx_filesync(mdbx_filehandle_t fd, bool filesize_changed) {
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
(void)fullsync;
|
||||
(void)filesize_changed;
|
||||
return FlushFileBuffers(fd) ? MDBX_SUCCESS : GetLastError();
|
||||
#elif __GLIBC_PREREQ(2, 16) || _BSD_SOURCE || _XOPEN_SOURCE || \
|
||||
(__GLIBC_PREREQ(2, 8) && _POSIX_C_SOURCE >= 200112L)
|
||||
@ -640,10 +640,10 @@ int mdbx_filesync(mdbx_filehandle_t fd, bool fullsync) {
|
||||
* see http://www.spinics.net/lists/linux-ext4/msg33714.html */
|
||||
#if _POSIX_C_SOURCE >= 199309L || _XOPEN_SOURCE >= 500 || \
|
||||
defined(_POSIX_SYNCHRONIZED_IO)
|
||||
if (!fullsync && fdatasync(fd) == 0)
|
||||
if (!filesize_changed && fdatasync(fd) == 0)
|
||||
return MDBX_SUCCESS;
|
||||
#else
|
||||
(void)fullsync;
|
||||
(void)filesize_changed;
|
||||
#endif
|
||||
if (fsync(fd) == 0)
|
||||
return MDBX_SUCCESS;
|
||||
|
Loading…
x
Reference in New Issue
Block a user