Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

fsync - synchronize changes to file

&pagelevel(4)&pagelevel

Syntax

#include <unistd.h>

int fsync(int fildes);

Description

fsync() causes all the modified data and attributes of fildes that are still in the buffer to bewritten to the physical storage medium.

Return val.

0

-1

if successful

if an error occurs; errno is set to indicate the error.

Errors

fsync() will fail if:

 

EBADF

fildes is not a valid file descriptor.

 

EINTR

A signal was caught during the fsync() system call.

 

EINVAL

fildes refers to a file on which this operation is not possible.

An attempt was made to access a BS2000 file.

 

EIO

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

Notes

fsync() should be used by programs which require modifications to a file to be completed before continuing; 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 are recorded.

fsync() is executed only for POSIX files. 

See also

unistd.h.