fdatasync() — Write changes to direct-access storage
Standards
| Standards / Extensions | C or C++ | Dependencies |
|---|---|---|
|
POSIX.1-2001
POSIX.1-2008 Single UNIX Specification, Version 2 |
both |
Format
#define _XOPEN_SOURCE 500
#include <unistd.h>
int fdatasync(int fildes);
General description
The fdatasync() function is equivalent to fsync(), which
doesn’t provide performance advantages.
Returned value
If successful, fdatasync() returns 0.
If unsuccessful,
fdatasync() returns -1 and sets errno to one
of the following values:- Error Code
- Description
- EBADF
fildesis not a valid open file descriptor.- EINVAL
- The file is not a regular file.
Note: If the
fdatasync() function fails, outstanding I/O operations are not
guaranteed to be completed.