Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)
Guardian Native C Library Calls (n - r) __ns_start_backup(3)
DESCRIPTION
The __ns_start_backup() function creates a backup process for the primary process.
This function can be called within Guardian processes only. When used in a program compiled
by the TNS compiler, this function can be called by Guardian modules (modules compiled for the
Guardian environment) only.
This function is called from the primary process to create and initialize the backup process. To
create the backup process, __ns_start_backup( ):
• Starts the backup process with a call to the PROCESS_CREATE_ Guardian procedure.
• Returns the process handle of the backup process, if the process started successfully.
To initialize the backup process, __ns_start_backup( ):
• Sends to the backup process the same startup, ASSIGN, and PARAM messages received
by the primary process.
• Calls __ns_fget_file_open_state() from the primary process to retrieve the file open
state information for the standard input, output, and error files.
• Sends the file open state information from the primary process to the backup process
using the $RECEIVE facility or other methods. The backup process then performs a
backup open of the standard files using the file open state information received the pri-
mary process. The sync depth of the standard files is 1.
Only the standard files have backup opens performed. Other files opened by the primary process
must be explicitly opened in the backup process by calls to __ns_backup_fopen( ). The file
states of the standard files in the backup process are not automatically set to the corresponding
file states in the primary process. If operations have been performed on a standard file before
__ns_start_backup() has been called, you must call __ns_fget_file_state() and
__ns_fset_file_state( ) to retrieve and set the file state for the standard files.
Use the backup_hometerm and backup_debug_options parameters to help test and debug pro-
cess pairs.
Refer to the Guardian Programmer’s Guide for complete details on active backup programming
in C.
RETURN VALUES
Upon successful completion, the value 0 (zero) is returned. Otherwise, -1 or a positive integer is
returned.
ERRORS
If an error occurs during process creation, the return value is a positive value that corresponds to
a PROCESS_CREATE_ error code. If you supplied an error_detail parameter, it contains the
PROCESS_CREATE_ error subcode. Refer to PROCESS_CREATE_ in the Guardian Pro-
cedure Calls Reference Manual for details.
If an error occurs during process initialization, the return value is -1 and errno is set to either of
the following:
Guardian file system error code
A file system error occurred.
[ENONSTOP] Any other error condition.
527192-005 Hewlett-Packard Company 5−19