Changeset View
Changeset View
Standalone View
Standalone View
src/util.cpp
Show First 20 Lines • Show All 1,102 Lines • ▼ Show 20 Lines | #ifdef WIN32 | ||||
} | } | ||||
#else | #else | ||||
#if defined(__linux__) || defined(__NetBSD__) | #if defined(__linux__) || defined(__NetBSD__) | ||||
// Ignore EINVAL for filesystems that don't support sync | // Ignore EINVAL for filesystems that don't support sync | ||||
if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { | if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { | ||||
LogPrintf("%s: fdatasync failed: %d\n", __func__, errno); | LogPrintf("%s: fdatasync failed: %d\n", __func__, errno); | ||||
return false; | return false; | ||||
} | } | ||||
#elif defined(__APPLE__) && defined(F_FULLFSYNC) | #elif defined(MAC_OSX) && defined(F_FULLFSYNC) | ||||
// Manpage says "value other than -1" is returned on success | // Manpage says "value other than -1" is returned on success | ||||
if (fcntl(fileno(file), F_FULLFSYNC, 0) == -1) { | if (fcntl(fileno(file), F_FULLFSYNC, 0) == -1) { | ||||
LogPrintf("%s: fcntl F_FULLFSYNC failed: %d\n", __func__, errno); | LogPrintf("%s: fcntl F_FULLFSYNC failed: %d\n", __func__, errno); | ||||
return false; | return false; | ||||
} | } | ||||
#else | #else | ||||
if (fsync(fileno(file)) != 0 && errno != EINVAL) { | if (fsync(fileno(file)) != 0 && errno != EINVAL) { | ||||
LogPrintf("%s: fsync failed: %d\n", __func__, errno); | LogPrintf("%s: fsync failed: %d\n", __func__, errno); | ||||
▲ Show 20 Lines • Show All 197 Lines • Show Last 20 Lines |