DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

fsync(S)


fsync -- synchronize changes to a file

Syntax

cc . . . -lc

int fsync(fildes)
int fildes;

Description

The fsync(S) routine causes all modified data and attributes of the file referred to by fildes to be written to storage media. This routine should be called when a program needs to record to storage media all its modifications to a file before continuing, for example, in updating a record during a transaction.

Return value

Upon successful completion, fsync(S) returns zero; otherwise, fsync(S) returns -1 and sets errno.

Diagnostics

fsync(S) will fail if:


[EBADF]
fildes is not a valid file descriptor.

[EINTR]
fsync(S) was interrupted by a signal.

[EINVAL]
It is impossible to write to the file referred to by fildes.

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

See also

fflush(S).

Standards conformance

fsync(S) is conformant with:
X/Open Portability Guide, Issue 3, 1989 .
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003