|FSYNC(2)||System Calls Manual||FSYNC(2)|
— synchronize a file's in-core state with that on
fsync() function causes all modified
data and attributes of fd to be moved to a permanent
storage device. This normally results in all in-core modified copies of
buffers for the associated file to be written to a disk.
fdatasync() function is similar to
fsync() except that it only guarantees modified data
(and metadata necessary to read that data) is committed to storage. Other
file modifications may be left unsynchronized.
fdatasync() should be used by programs that require
a file to be in a known state, for example, in building a simple transaction
fdatasync() fail with
the state of the on-disk data may have been only partially written. To guard
against potential inconsistency, future calls will continue failing until
all references to the file are closed.
fdatasync() functions return the value 0 if
successful; otherwise the value -1 is returned and the global
variable errno is set to indicate the error.
fdatasync() functions fail if:
fdatasync() functions conform to
IEEE Std 1003.1-2008 (“POSIX.1”).
fsync() system call first appeared in
4.1cBSD, and the
function has been available since OpenBSD 5.4.
fdatasync() function is currently a
fsync(), so it synchronizes more
state than necessary.
|April 18, 2019||OpenBSD-current|