[Previous]
[Contents]
[Next]

qnx_sync()

request that the file system manager flush inodes and blocks to disk

Synopsis:

#include <sys/types.h>
#include <unistd.h>
int qnx_sync( nid_t nid );

Description:

The qnx_sync() function requests that the filesystem manager running on the node indicated by nid 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.

Returns:

0
Success
-1
An error occurred. errno is set to indicate the error.

Errors:

ENOSYS
The sync() function isn't supported by the filesystem manager. Support for it exists in QNX4.1 Fsys or later.
ESRCH
No filesystem manager is running on the indicated node.

Examples:

/*
 * Tell Fsys on a specified node to start sync'ing
 */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>

void main( int argc, char *argv[] )
{
  nid_t nid = 0;
  int status = EXIT_SUCCESS;

  if( argc > 2 ) {
    fprintf( stderr, "use: %s [node]\n", argv[0] );
    exit( 0 );
  }
  else if( argc == 2 )
    nid = atol( argv[1] );

  if( qnx_sync( nid ) != 0 ) {
    status = EXIT_FAILURE;
    perror("sync");
  }

  exit( status );
}

Classification:

QNX

Safety:
Interrupt handler No
Signal handler Yes, but modifies errno
Thread Yes

See also:

errno, fdatasync(), fsync(), sync(), umount()


[Previous]
[Contents]
[Next]