Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)

__ns_fset_le_state(3) Guardian Native C Library Calls Reference Manual
NAME
__ns_fset_le_state - Sets the le state information for a le 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_fset_le_state (
FILE *stream,
__ns_std_io_le_state *le_state);
PARAMETERS
stream Species a le opened for ANSI I/O.
file_state Points to a variable that stores the le state information.
DESCRIPTION
The __ns_fset_le_state function sets the le state information for a le 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 backup process to update its state information for the le. Before
calling this function, the primary process must have rst called the __ns_fget_le_state() func-
tion to retrieve the le state information and sent the state information to the backup process.
The variable containing the le state information, not the pointer to the variable, must be sent
from the primary process to the backup process.
The only meaningful operations on le state information are retrieving with the
__ns_fget_le_state( ) function, setting with the __ns_fset_le_state() function, and copying
with an assignment statement or a copy function from the C run-time library. The results of
manipulating components of the le state information are undened.
The buffer for le operations is not part of the le state. This affects the input and output streams:
For input streams, the le position is a component of the le state. The
__ns_fset_le_state( ) function updates the le position for the backup process to the le
position of the primary process at the time the __ns_fget_le_state() function was
called. Thus, buffering is not an issue for an input stream from a disk device. For all
other input streams, buffered but unread input is lost. For these nondisk input streams,
you can disable buffering with either the setvbuf or setnbuf function, ignore the lost
information, or manage the buffer yourself.
For output streams, a call to a write function in user code might leave a partially lled,
unushed buffer. To ensure that the buffer is ushed, you can:
Perform a ush operation, such as a call to the fush() function, prior to calling
the __ns_fget_le_state() function.
Ignore the effects of unushed buffers, if the unushed buffer contents are not
critical to the application.
516 Hewlett-Packard Company 527192-005