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

  man pages->HP-UX 11i man pages -> fsync (2)              
Title
Content
Arch
Section
 

Contents


 fsync(2)                                                           fsync(2)




 NAME    [Toc]    [Back]
      fsync, fdatasync - synchronize a file's in-core and on-disk states

 SYNOPSIS    [Toc]    [Back]
      #include <unistd.h>

      int fsync(int fildes);

      int fdatasync(int fildes);

 DESCRIPTION    [Toc]    [Back]
      fsync() and fdatasync() cause all modified data and attributes of
      fildes to be moved to a permanent storage device.  This normally
      results in all in-core modified copies of buffers for the associated
      file to be written to a disk.  fsync() and fdatasync() apply to
      ordinary files, and apply to block special devices on systems which
      permit I/O to block special devices.

      fsync() and fdatasync() should be used by programs that require a file
      to be in a known state, such as when building a simple transaction
      facility.

      fdatasync() causes all modified data and file attributes of fildes
      required to retrieve the data to be written to disk.

      fsync() causes all modified data and all file attributes of fildes
      (including access time, modification time and status change time) to
      be written to disk.

      Together, fsync() and fdatasync() constitute support for File
      Synchronization.

 RETURN VALUE    [Toc]    [Back]
      fsync() and fdatasync() return 0 on success or -1 if an error occurs,
      and set errno to indicate the error.

 ERRORS    [Toc]    [Back]
      fsync and fdatasync fail if any of the following conditions are
      encountered:

           [EBADF]        fildes is not a valid descriptor.

           [EINVAL]       fildes refers to a file type to which fsync() or
                          fdatasync() does not apply.

 WARNINGS    [Toc]    [Back]
      The current implementation of these functions is inefficient for large
      files.

 AUTHOR    [Toc]    [Back]
      fsync() was developed by the the University of California, Berkeley



 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003






 fsync(2)                                                           fsync(2)




      and HP.

 SEE ALSO    [Toc]    [Back]
      fcntl(2), fcntl(5), open(2), select(2), sync(2), sync(1M), unistd(5).

 STANDARDS CONFORMANCE    [Toc]    [Back]
      fsync(): AES, SVID3, XPG3, XPG4, POSIX.4

      fdatasync(): POSIX.4


 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003
[ Back ]
      
      
 Similar pages
Name OS Title
sync OpenBSD synchronize disk block in-core status with that on disk
sync NetBSD synchronize disk block in-core status with that on disk
fsync NetBSD synchronize a file's in-core state with that on disk
fdatasync Linux synchronize a file's in-core data with that on disk
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 Linux synchronize a file's complete in-core state with that on disk
msync Tru64 Synchronize a mapped file
msync Linux synchronize a file with a memory map
fdatasync NetBSD synchronize the data of a file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service