Index of Section 2 Manual Pages
| Interix / SUA | fsync.2 | Interix / SUA |
fsync(2) fsync(2)
fsync()
NAME
fsync() - synchronize disk and in-memory versions of a file
SYNOPSIS
#include
int fsync (int fd)
DESCRIPTION
The fsync(2) call flushes the buffer for the specified file descriptor
causes all modified data and attributes of fd to be moved to a permanent
storage device. It flushes to disk the buffers for the specified file
descriptor.
Use fsync(2) in programs that require a file to be in a known state, for
example, in building a simple transaction facility.
RETURN VALUES
The fsync(2) call returns 0 for success. On an error, it returns -1 and
sets errno to indicate the error.
ERRORS
The fsync(2) call fails for the following reasons:
[EBADF]
The file descriptor fd was invalid.
[EINTR]
The function was interrupted by a signal.
[EINVAL]
The file referred to by fd doesn't support the operation.
[EIO]
An I/O error occurred.
USAGE NOTES
The fsync function is thread safe.
The fsync function is async-signal safe.