*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Linux man pages -> fdatasync (2)              
Title
Content
Arch
Section
 

FDATASYNC(2)

Contents


NAME    [Toc]    [Back]

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

SYNOPSIS    [Toc]    [Back]

       #include <unistd.h>

       #ifdef _POSIX_SYNCHRONIZED_IO

       int fdatasync(int fd);

       #endif

DESCRIPTION    [Toc]    [Back]

       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.

RETURN VALUE    [Toc]    [Back]

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

ERRORS    [Toc]    [Back]

       EBADF  fd is not a valid file descriptor open for writing.

       EROFS, EINVAL
	      fd  is  bound  to a special file which does not support synchronization.


       EIO    An error occurred during synchronization.

BUGS    [Toc]    [Back]

       Currently (Linux 2.2) fdatasync is equivalent to fsync.

CONFORMING TO    [Toc]    [Back]

       POSIX1b (formerly POSIX.4)

SEE ALSO    [Toc]    [Back]

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



Linux 1.3.86			  1996-04-13			  FDATASYNC(2)
[ Back ]
 Similar pages
Name OS Title
sync NetBSD synchronize disk block in-core status with that on disk
sync OpenBSD synchronize disk block in-core status with that on disk
fdatasync HP-UX synchronize a file's in-core and on-disk states
fsync OpenBSD synchronize a file's in-core state with that on disk
fsync FreeBSD synchronize a file's in-core state with that on disk
fsync HP-UX synchronize a file's in-core and on-disk states
fsync NetBSD synchronize a file's in-core state with that on disk
fsync Linux synchronize a file's complete in-core state with that on disk
fdatasync NetBSD synchronize the data of a file
sync2 Tru64 Flush file system metadata and data from memory buffers to disk
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service