OAR

RTEMS 4.5.0 On-Line Library


Input and Output Primitives Manager fdatasync - Synchronize file in-core data with that on disk.

PREV UP NEXT Bookshelf RTEMS POSIX API User's Guide

5.4.10: fdatasync - Synchronize file in-core data with that on disk.

CALLING SEQUENCE:

int fdatasync(
  int fd
);

STATUS CODES:

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.
EINVAL
fd is bound to a special file which does not support synchronization.
EIO
An error occurred during synchronization.
EROFS
fd is bound to a special file which dows not support synchronization.

DESCRIPTION:

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.

NOTES:

NONE


PREV UP NEXT Bookshelf RTEMS POSIX API User's Guide

Copyright © 1988-2000 OAR Corporation