Implementation status: to be implemented


#include <unistd.h>

int fdatasync(int fildes);


The fdatasync() function synchronizes the data of the file.


fildes - the file descriptor.

The fdatasync() function forces all currently queued I/O operations associated with the file indicated by file descriptor fildes to the synchronized I/O completion state.

Return value

Upon successful completion, the fdatasync() function returns 0, otherwise, -1 is returned and errno set to indicate the error.

If the function fails, outstanding I/O operations are not guaranteed to be completed.


[EBADF] The fildes argument is not a valid file descriptor
[EINVAL] This implementation does not support synchronized I/O for this file.

Implementation tasks

  • Implement the fdatasync() function.