DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

fsync(S-osr5)


fsync -- synchronize changes to a file

Syntax

cc . . . -lc

int fsync(fildes)
int fildes;

Description

The fsync(S-osr5) 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-osr5) returns zero; otherwise, fsync(S-osr5) returns -1 and sets errno.

Diagnostics

fsync(S-osr5) will fail if:


[EBADF]
fildes is not a valid file descriptor.

[EINTR]
fsync(S-osr5) 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-osr5).

Standards conformance

fsync(S-osr5) is conformant with:
X/Open Portability Guide, Issue 3, 1989 .
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005