[Previous]
[Contents]
[Next]

sync()

ask the filesystem manager to flush buffers to disk

Synopsis:

#include <unistd.h>
void sync( void );

Description:

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.


Note: The function will likely return before the operation is complete. There's no way to determine when the operation is complete.

Examples:

/*
 * Tell the local Fsys (if any) to start sync'ing
 */
#include <stdlib.h>
#include <unistd.h>

void main()
  {
    sync();
    exit( 0 );
  }

Classification:

UNIX

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

fdatasync(), fsync(), qnx_sync(), umount()


[Previous]
[Contents]
[Next]