Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)
Guardian Native C Library Calls (n - r) __ns_fget_
file_open_state(3)
NAME
__ns_fget_file_open_state - Returns file open state information for a file opened for ANSI I/O
LIBRARY
G-series native nonPIC Guardian processes: $SYSTEM.SYSTEM.CRTLNS
G-series native PIC Guardian processes: $SYSTEM.SYSTEM.CRTLNS2
H-series native Guardian processes: $SYSTEM.ZDLLnnn.CRTLNSE
SYNOPSIS
#include <crtlns.h>
long __ns_fget_file_open_state (
FILE *stream,
__ns_std_io_file_open_state *file_open_state);
PARAMETERS
stream Specifies a file opened for ANSI I/O.
file_open_state Points to a variable that stores the file open state information.
DESCRIPTION
The __ns_fget_file_open_state() function returns the file open state information for a file opened
for ANSI I/O.
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 retrieve the current file open state informa-
tion. The primary process can send the state information using the $RECEIVE facility or other
methods 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 from the primary process to the backup process.
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 infor-
mation are undefined.
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, the value -1 is returned.
ERRORS
If any of the following conditions occur, the __ns_fget_file_open_state() function sets errno to
the corresponding value:
[ENONSTOP] The file specified in the stream argument is not open.
Guardian file system error code
A file system error occurred.
527192-005 Hewlett-Packard Company 5−9