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

  man pages->IRIX man pages -> standard/fsync (2)              
Title
Content
Arch
Section
 

Contents


fsync(2)							      fsync(2)


NAME    [Toc]    [Back]

     fsync, fdatasync -	synchronize a file's in-memory state with that on the
     physical medium

SYNOPSIS    [Toc]    [Back]

     #include <unistd.h>

     int fsync(int fildes);
     int fdatasync(int fildes);

DESCRIPTION    [Toc]    [Back]

     fsync moves all modified data and attributes of fildes to a storage
     device.  When fsync returns, all in-memory	modified copies	of buffers
     associated	with fildes have been written to the physical medium.  fsync
     is	different from sync, which schedules disk I/O for all files but
     returns before the	I/O completes.

     fsync should be used by programs that require that	a file be in a known
     state.  For example, a program that contains a simple transaction
     facility might use	fsync to ensure	that all changes to a file or files
     caused by a given transaction were	recorded on a storage medium.

     fdatasync is the same as  fsync, except that it only moves	all the
     modified data, and	not the	attributes of fildes to	a storage device.

     fsync  and	fdatasync fail if one or more of the following are true:

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

     ENOLINK	    fildes is on a remote machine and the link on that machine
		    is no longer active.

     EINTR	    A signal was caught	during execution of the	system call.

     EIO	    An I/O error occurred while	reading	from or	writing	to the
		    file system.

     EINVAL	    fildes is not a valid descriptor Synchronized I/O.

DIAGNOSTICS    [Toc]    [Back]

     Upon successful completion, a value of 0 is returned. Otherwise, a	value
     of	-1 is returned and errno is set	to indicate the	error.

NOTES    [Toc]    [Back]

     The way the data reach the	physical medium	depends	on both	implementation
     and hardware.  fsync returns when the device driver tells it that the
     write has taken place.

SEE ALSO    [Toc]    [Back]

      
      
     sync(2)


									PPPPaaaaggggeeee 1111
[ Back ]
 Similar pages
Name OS Title
aio_fsync IRIX asynchronously synchronize a file's in-memory state with that on the physical medium
msync HP-UX synchronize the memory of a mapped file with physical storage
msync IRIX synchronize memory with physical storage
msync Linux synchronize a file with a memory map
fsync FreeBSD synchronize a file's in-core state with that on disk
fsync NetBSD synchronize a file's in-core state with that on disk
fsync OpenBSD 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
pvmove HP-UX move allocated physical extents from one LVM physical volume to other physical volumes
mem Tru64 physical memory interface
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service