Guardian Programmer's Guide

Table Of Contents
Fault-Tolerant Programming in C
Guardian Programmer’s Guide 421922-014
27 - 5
C Extensions That Support Active
Backup Programming
C Extensions That Support Active
Backup Programming
C provides several functions that you can use to perform various tasks required for
active backup programming. This subsection provides a brief overview of these
functions. These functions are available for TNS and accelerated programs as well as
for TNS/R native programs. For details, refer to the Guardian TNS C Library Calls
Reference Manual and the Guardian TNS/R Native C Library Calls Reference Manual.
The following table summarizes the C functions used for active backup programming:
Starting the Backup Process
The primary process starts and initializes the backup process by calling the
__ns_start_backup function. The __ns_start_backup function does the
following:
Starts the backup process. You can optionally specify the CPU in which the
backup process is to run.
Optionally returns the process handle of the backup process (assuming the backup
process was started successfully).
Sends to the backup process the same startup, assign, and param messages that
the primary process received.
Gets file open state information for the stdin, stdout, and stderr files that the
primary process opened during its initialization, and sends that information to the
backup process. The backup process receives the open state information through
the $RECEIVE file.
The backup process has the same swap volume as the primary process.
Function Use
__ns_start_backup Called by the primary process to create and initialize the backup
pro
cess.
__ns_fopen_special Called by the primary process to open a file with a specified
s
ync depth.
__ns_fget_file_open_stat
e
Called by the primary process to obtain open state information
fo
r a file.
__ns_backup_fopen Called by the backup process to back up open files that have
alr
eady been opened by the primary process.
__ns_fget_file_state Called by the primary process to obtain file state information.
__ns_fset_file_state Called by the backup process to update file state information.