C/C++ Programmer's Guide (G06.27+, H06.08+, J06.03+)
Table 12 C Functions for Active Backup Programming (continued)
Called by the primary process to obtain open state information for a file.__ns_fget_file_open_state()
Called by the primary process to open a file with a specified sync depth.__ns_fopen_special()
These functions are described in the Guardian TNS C Library Calls Reference Manual and Guardian
Native C Library Calls Reference Manual. See the Guardian Programmer’s Guide for a description
of active backup programming, including:
• An overview of the activities an active backup program must perform
• Detailed explanations of how to code an active backup program
• Examples of active backup programs
Environment-Specific Functions
There are several file-system functions that allow you to operate on a file in the opposite environment
without writing and compiling a separate module for that environment. These functions are fopen(),
freopen(), remove(), rename(), tmpfile(), and tmpnam(). Each of these functions has
environment-specific variants with suffixes to indicate which type of file you want to operate on.
For example, fopen_guardian() opens a Guardian file in an OSS module and fopen_oss()
opens an OSS file in a Guardian module.
NOTE: If a TNS module calls any of the environment-specific variants, the feature-test macro
_INTEROPERABLE must be specified when the module is compiled. Specifying _INTEROPERABLE
allows subsequent I/O function calls to know which type of I/O stream they are operating on.
For more details, see the Open System Services Programmer’s Guide.
Changes Required to Interoperable Compilation Modules at D44
At the D44 release, preexisting TNS/R native C programs that call any of these functions to access
files in the OSS environment might need to be recompiled with a native C compiler:
fopen()
fopen_oss()
freopen()
freopen_oss()
remove()
remove_oss()
rename()
rename_oss()
tmpnam()
tmpnam_oss()
tmpfile()
tmpfile_oss()
After the D44 release, each of these functions has a Guardian variant, such as
fopen_guardian(), and each has an OSS variant, such as fopen_oss().
Recompilation is required for compilations made using a compiler released before D44 (G04) if
the execution environment is to be D44 or later (G04 or later).
You do not need to recompile Guardian TNS/R native programs that call these functions to access
Guardian files, and OSS programs that call these functions to access OSS files.
Environment-Specific Functions 77