fsync


Description:

[ Version ( since = "2.64" ) ]
[ CCode ( cname = "g_fsync" ) ]
public int fsync (int fd)

A wrapper for the POSIX `fsync()` function.

On Windows, `_commit()` will be used. On macOS, `fcntl(F_FULLFSYNC)` will be used. The `fsync()` function is used to synchronize a file's in-core state with that of the disk.

This wrapper will handle retrying on `EINTR`.

See the C library manual for more details about fsync.

Parameters:

fd

a file descriptor

Returns:

0 on success, or -1 if an error occurred. The return value can be used exactly like the return value from fsync.


Namespace: GLib.FileUtils
Package: glib-2.0