fsync(S) 6 January 1993 fsync(S) Name 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.