diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2021-01-07 21:56:42 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2021-01-07 22:07:33 +0100 |
commit | 86a8b35f321d55bb2381ea56bcc1cdd17c7896e6 (patch) | |
tree | f9ec50c2ecb64f0110056a68b34d4c7472a2cb4a /src/util/system.h | |
parent | d7e2401c629be3db6ceef551ee0f74deb56c02d1 (diff) | |
parent | ef712298c3f8bc2afdad783f05080443b72b3f77 (diff) |
Merge #14501: Fix possible data race when committing block files
ef712298c3f8bc2afdad783f05080443b72b3f77 util: Check for file being NULL in DirectoryCommit (Luke Dashjr)
457490403853321d308c6ca6aaa90d6f8f29b4cf Fix possible data race when committing block files (Evan Klitzke)
220bb16cbee5b91d0bc0fcc6c71560d631295fa5 util: Introduce DirectoryCommit commit function to sync a directory (Evan Klitzke)
ce5cbaea63ad4ea78e533bdb14f47f414061ae7f util.h: Document FileCommit function (Evan Klitzke)
844d650eea3bd809884cc5dd996a388bdc58314e util: Prefer Mac-specific F_FULLSYNC over fdatasync in FileCommit (Evan Klitzke)
f6cec0bcaf560fa310853ad3fe17022602b63d5f util: Refactor FileCommit from an #if sequence nested in #else, to a sequence of #elif (Evan Klitzke)
Pull request description:
Reviving #12696
ACKs for top commit:
laanwj:
Code review ACK ef712298c3f8bc2afdad783f05080443b72b3f77
Tree-SHA512: 07d650990ef4c18d645dee3f9a199a940683ad17557d79d93979a76c4e710d8d70e6eae01d1a5991494a24a7654eb7db868be0c34a31e70b2509945d95bc9cce
Diffstat (limited to 'src/util/system.h')
-rw-r--r-- | src/util/system.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/system.h b/src/util/system.h index 2be8bb754b..010fc5b49f 100644 --- a/src/util/system.h +++ b/src/util/system.h @@ -56,7 +56,19 @@ bool error(const char* fmt, const Args&... args) } void PrintExceptionContinue(const std::exception *pex, const char* pszThread); + +/** + * Ensure file contents are fully committed to disk, using a platform-specific + * feature analogous to fsync(). + */ bool FileCommit(FILE *file); + +/** + * Sync directory contents. This is required on some environments to ensure that + * newly created files are committed to disk. + */ +void DirectoryCommit(const fs::path &dirname); + bool TruncateFile(FILE *file, unsigned int length); int RaiseFileDescriptorLimit(int nMinFD); void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length); |