URL: http://www.firstbasesoftware.com/man/man3/fb_sync.htm
Last modified: 12 September 1995
Copyright © by FirstBase Software.
[ Index of Contents] [ FirstBase RDBMS Overview]


NAME

fb_sync - synchronize memory with disk data

SYNOPSIS

#include <firstbase/fb.h>

fb_sync(db)
fb_database *db;

DESCRIPTION

The FirstBase system allows the use of multiple processes to read and write to the same database and index objects at the same time. Fb_sync forces all data in memory to be written to the disk and updates the status of open database and index file descriptors.

By using fb_sync with fb_lock, the FirstBase system provides safe access to changing database objects, even under a Network File System (NFS).

For example, if multiple processes need to share an index, like the FirstBase tool dbvedit, then calls to gethead and getxhead will be needed, and maybe even getxrec. To ensure that data within the database is unchanging during these calls, this critical section can be protected by locking record zero. Fb_sync is then used to force the current process to update each open file descriptor.

   fb_lock(0, db, FB_WAIT);
   fb_sync(d);
   fb_getxhead(db->ihfd, &db->bsmax, &db->bsend);
   fb_gethead(db);
   if (fb_getxrec(key, d) == FB_AOK)
      ...
   fb_unlock(0, db);

CLIENT/SERVER

The fb_sync routine will transparently call the fb_sync_clnt mechanism when the global FirstBase variable cdb_use_rpc is set to one. See fb_clnt_create(3) for more details.

SEE ALSO

database(4), fb_lock(3).

DIAGNOSTICS

Mainly needed with NFS disks and files, fb_sync uses the UNIX fsync(2) utility.


URL: http://www.firstbasesoftware.com/man/man3/fb_sync.htm
Last modified: 12 September 1995
Copyright © by FirstBase Software.
[ Index of Contents] [ FirstBase RDBMS Overview]