FAT | RFS | XFS
vsync()
PROTOTYPE
#include <posix.h>
int vsync(const char *path);
DESCRIPTION
vsync() is a non-standard routine that flushes all buffered data, both metadata and user data, to backing store for the specified volume. It doesn’t return until all changes are saved.
path is the volume name, the path to any file on the volume, or NULL to select the volume holding the CWD. Paths starting with ‘/’ are absolute. Otherwise they are relative to the CWD.
If successful, vsync() returns 0. Otherwise, it sets errno and returns EOF.
ERROR CODES
| ENAMETOOLONG | A name in path exceeds the effective maximum file name length. |
| ENOENT | path is the empty string or includes a name that was not found. |
| ENOTDIR | One of the non-leaf path components is not a directory. |
| EROFS | The volume is read-only. |
EXAMPLE
/*-------------------------------------------------------------------*/
/* Flush and close the log file. Free the read/write buffer. */
/*-------------------------------------------------------------------*/
if (vsync(log_vol))
return -1;
close(log_fid);
free(buf);