Computer Science


FDATASYNC(2)        Linux Programmer's Manual        FDATASYNC(2)

NAME
       fdatasync - synchronize a file's in-core data with that on
       disk

SYNOPSIS
       #include <unistd.h>

       #ifdef _POSIX_SYNCHRONIZED_IO

       int fdatasync(int fd);

       #endif

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 opera-
       tions: 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.

RETURN VALUE
       On success, zero is returned.  On error, -1  is  returned,
       and errno is set appropriately.

ERRORS
       EBADF   fd  is  not a valid file descriptor open for writ-
               ing.

       EROFS, EINVAL
               fd is bound to a special file which does not  sup-
               port synchronization.

       EIO     An error occurred during synchronization.

BUGS
       Currently (Linux 2.0.23) fdatasync is equivalent to fsync.

CONFORMING TO
       POSIX1b (formerly POSIX.4)

SEE ALSO
       fsync(2), B.O. Gallmeister, POSIX.4, O'Reilly, pp. 220-223
       and 343.

Linux 1.3.86              13 April 1996                         1

Back to the index


Apply now!


Handbook

Postgraduate study options

Computer Science Blog



Please give us your feedback or ask us a question

This message is...


My feedback or question is...


My email address is...

(Only if you need a reply)

A to Z Directory | Site map | Accessibility | Copyright | Privacy | Disclaimer | Feedback on this page