up | Inhaltsverzeichniss | Kommentar

Manual page for FSYNC(2)

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

SYNOPSIS

int fsync(fd)

int fd;

DESCRIPTION

fsync() moves all modified data and attributes of fd to a permanent storage device: all in-core modified copies of buffers for the associated file have been written to a disk when the call returns. Note: this is different than sync.2 which schedules disk I/O for all files (as though an fsync() had been done on all files) but returns before the I/O completes.

fsync() should be used by programs which require a file to be in a known state; for example, a program which contains a simple transaction facility might use it to ensure that all modifications to a file or files caused by a transaction were recorded on disk.

RETURN VALUES

fsync() returns:

0
on success.
-1
on failure and sets errno to indicate the error.

ERRORS

EBADF
fd is not a valid descriptor.
EINVAL
fd refers to a socket, not a file.
EIO
An I/O error occurred while reading from or writing to the file system.

SEE ALSO

cron.8 sync.2


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97