ask the filesystem manager to flush buffers to disk
#include <unistd.h> void sync( void );
The sync() function requests that the local filesystem manager, if one exists, start flushing all updated in-memory inodes and blocks in the buffer cache to disk.
The function will likely return before the operation is complete. There's no way to determine when the operation is complete. |
/* * Tell the local Fsys (if any) to start sync'ing */ #include <stdlib.h> #include <unistd.h> void main() { sync(); exit( 0 ); }
UNIX
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
fdatasync(), fsync(), qnx_sync(), umount()