Web Hosting Directory | Web Hosting Resources | Webmaster Resources | Domain Tools | Search Engine Marketing | Forums
  Signup
Today: 896   Yesterday: 1,172   Max: 1,872   Total: 384,277   Current Users : 19 (Member 0) 
DOMAIN TOOLS

WEBMASTER TOOLS

RELATED ARTICLES

SUBMIT AN ARTICLE

Write for us and get publicity, link to your website, and best of all get paid. Please visit our writers page for details.


LINK TO US

Link to us and earn points for each visitor you bring to us. Please visit our link partner page for details.

 
Search Linux manpages For:  

fsync(2) -- Linux man page

 

NAME

fsync, fdatasync - synchronize a file's complete in-core state with that on disk  

SYNOPSIS

#include <unistd.h>

int fsync(int fd);

int fdatasync(int fd);  

DESCRIPTION

fsync copies all in-core parts of a file to disk, and waits until the device reports that all parts are on stable storage. It also updates metadata stat information. It does not necessarily ensure that the entry in the directory containing the file has also reached disk. For that an explicit fsync on the file descriptor of the directory is also needed.

fdatasync does the same as fsync but only flushes user data, not the meta data like the mtime or atime.

 

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

NOTES

In case the hard disk has write cache enabled, the data may not really be on permanent storage when fsync/fdatasync return.

When an ext2 file system is mounted with the sync option, directory entries are also implicitly synced by fsync.

On kernels before 2.4, fsync on big files can be inefficient. An alternative might be to use the O_SYNC flag to open(2).  

CONFORMING TO

POSIX.1b (formerly POSIX.4)  

SEE ALSO

bdflush(2), open(2), sync(2), mount(8), update(8), sync(8)


 
 
What is your major source of website traffic?
 
 
 
 
 
 

ADVERTISEMENT

 
Cheap Web HostingBudget Web HostingEcommerce Web Hosting
Link to UsLink ExchangeAdvertisePrivacy PolicyTerms Of ServiceAbout UsContact UsSitemap
Copyright © 2006 - 2008 Broadband Media, Inc. All rights reserved.