fdatasync - synchronize a files in-core data with that on disk
Synopsis
Description
Errors
Bugs
Availability
--> #include <unistd.h>int fdatasync(int fd);
fdatasync() flushes all data buffers of a file to disk (before the system call returns). It resembles fsync() but is not required to update the metadata such as access time.Applications that access databases or log files often write a tiny data fragment (e.g., one line in a log file) and then call fsync() immediately in order to ensure that the written data is physically stored on the harddisk. Unfortunately, fsync() will always initiate two write operations: one for the newly written data and another one in order to update the modification time stored in the inode. If the modification time is not a part of the transaction concept fdatasync() can be used to avoid unnecessary inode disk write operations.
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
EBADF fd is not a valid file descriptor open for writing. EIO An error occurred during synchronization. EROFS, EINVAL fd is bound to a special file which does not support synchronization.
Currently (Linux 2.2) fdatasync() is equivalent to fsync().
On POSIX systems on which fdatasync() is available, _POSIX_SYNCHRONIZED_IO is defined in <unistd.h> to a value greater than 0. (See also sysconf(3).)
POSIX.1-2001.
fsync(2) sync_file_range(2),
B.O. Gallmeister, POSIX.4, OReilly, pp. 220-223 and 343. or go to Top of page | Section 2 | Main Man Index.
| Linux 1.3.86 | FDATASYNC (2) | 1996-04-13 |