Guardian C Library Calls Reference Manual

Reference to Library Calls
Guardian TNS C Library Calls Reference Manual128833 3-127
__ns_backup_fopen (supplementary)
Return Value
0 if the operation is successful, -1 if an error occurs.
Usage Guidelines
This function is called from the backup process to perform a backup open of the file.
Before calling this function, the primary process must have first called the
__ns_fget_file_open_state function to retrieve the file open state information and
sent the state information through the $RECEIVE facility to the backup process.
The variable containing the file state information, not the pointer to the variable,
must be sent through the $RECEIVE facility from the primary process to the backup
process.
The backup file open does not perform any fopen function access_mode actions that
create or truncate a file. File creation and truncation actions are not necessary
because these actions were performed by the initial fopen call in the primary
process.
If an error occurs, errno is set to one of the following:
ENOIMEM, if insufficient memory is available.
An fopen function error code, if an error occurs on the file open.
A Guardian file system error code, if a file system error occurs. (Error 12 indicates
the backup open cannot obtain the same file number assigned to the primary open.)
An error detected in the backup process is not automatically sent to the primary
process. User code must handle such processing.
The only meaningful operations on file open state information are retrieving with the
__ns_fget_file_open_state function, starting a backup file open with the
__ns_backup_open function, and copying with an assignment statement or a copy
function from the C run-time library. The results of manipulating components of the
file open state information are undefined.
In addition to either the CLARGE or CWIDE library file, you must bind the
CNONSTOP library file into programs that use this function.
This function can only be used in the Guardian environment.
Refer to the Guardian Programmer’s Guide for complete details on fault-tolerant
programming in C.