C/C++ Programmer's Guide (G06.25+)
Using the C Run-Time Library
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
4-9
Active Backup Programming Functions
critical data serves two purposes: to provide sufficient information to enable the backup 
process to resume application processing (file state and application state information), 
and to indicate to the backup process where it should logically resume application 
processing (control state information).
The backup process receives messages from two sources. It receives critical 
information from the primary process (state information), which it must record for future 
use in the event it must take over processing from the primary process. It can also 
receive messages from the operating system indicating that the primary process or 
processor has failed. If the primary process fails, the backup process takes over 
processing at the logical point in the application indicated by the most recent control 
state information received from the primary process, and it continues processing using 
the most recent file state and application state information. 
Table 4-3 lists the functions used to write active backup programs.
These functions are described in the Guardian TNS C Library Calls Reference Manual 
and Guardian Native C Library Calls Reference Manual. Refer to the Guardian 
Programmer’s Guide for a description of active backup programming, including:
•
An overview of the activities an active backup program must perform
•
Detailed explanations of how to code an active backup program
•
Examples of active backup programs
Table 4-3. C Functions for Active Backup Programming
Function Use
__ns_start_backup() Called by the primary process to create and 
initialize the backup process.
__ns_backup_fopen() Called by the backup process to open files that 
have already 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.
__ns_fget_file_open_state() Called by the primary process to obtain open 
state information for a file.
__ns_fopen_special() Called by the primary process to open a file with 
a specified sync depth.










