Synchronize the file state
#include <unistd.h> int fsync( int filedes );
- The descriptor for the file that you want to synchronize.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The fsync() function forces all queued I/O operations for the file specified by the filedes file descriptor to finish, synchronizing the file's state. The function blocks until this is finished. For more information about synchronizing, see Filesystems and block I/O (devb-*) drivers in the Fine-Tuning Your System chapter of the QNX Neutrino User's Guide.
Although similar to fdatasync(), fsync() also guarantees the integrity of file information such as access and modification times.
0 for success, or -1 if an error occurs (errno is set).
- The filedes argument isn't a valid file descriptor open for writing.
- The implementation doesn't support synchronized I/O for the given file.
- The fsync() function isn't supported for the filesystem specified by filedes.