fsync - synchronize a file's complete in-core state with that on disk

#include <unistd.h>

int fsync(int fd);

fsync  copies  all  in-core parts of a file to disk, and waits until the device reports that all parts
are on stable storage.  It also updates metadata stat information. It does not necessarily ensure that
the  entry  in the directory containing the file has also reached disk.  For that an explicit fsync on
the file descriptor of the directory is also needed.