Guardian C Library Calls Reference Manual

__ns_fget_file_open_state (supplementary)
3-128 128833Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
__ns_fget_file_open_state (supplementary)
The __ns_fget_file_open_state function returns the file open state information for a file
open for ANSI I/O.
stream
denotes a file opened for ANSI I/O.
file_open_state
points to a variable that stores the file open state information.
Return Value
0 if the operation is successful, -1 if an error occurs.
Usage Guidelines
This function is called from the primary process to retrieve the current file open state
information. The primary process sends the state information through the
$RECEIVE facility to the backup process. The backup process calls the
__ns_backup_fopen function to perform a backup open of the file.
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.
If an error occurs, errno is set to one of the following:
ENONSTOP, if the file specified in the stream argument is not open.
A Guardian file system error code, if a file system error occurs.
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_fopen 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.
#include <nonstoph>
long __ns_fget_file_open_state(
FILE *stream,
__ns_std_io_file_open_state *file_open_state);