Guardian Programmer's Guide

Table Of Contents
Fault-Tolerant Programming in C
Guardian Programmer’s Guide 421922-014
27 - 36
Program Declarations
#include "$system.zspidef.zspic (zspi_ddl_char8,zspi_ddl_unit)"
nolist
#pragma search "$system.system.cnonstop" for TNS and accelerated
programs, or search "$system.system.crtlns" in the compiler command line
for TNS/R native programs, causes the library containing the C functions for fault-
tolerant support to be bound into the program.
#pragma wide specifies the wide-data model (TNS and accelerated programs only).
nonstoph for TNS and accelerated programs, or crtlnsh for native programs,
provides declarations required by the C functions for active backup programming.
stringh and stdioh are standard header files. cextdecs includes declarations for
the following Guardian procedures required by the program:
FILE_GETRECEIVEINFO_, which is called by the backup process to get
information about messages it receives.
FILE_OPEN_, which is called by the primary process to open the backup process,
and by the backup process to open $RECEIVE.
MONITORCPUS, which is called by the backup process to monitor the primary
process CPU. The operating system sends the backup process a “processor
down” message if the monitored CPU fails.
PROCESS_GETINFO_, PROCESS_GETPAIRINFO_, and
PROCESSHANDLE_DECOMPOSE_, which are used to obtain information about
the primary and backup processes.
PROCESSHANDLE_COMPARE_, which is called by the backup process to
determine if a message it received was sent by the primary process.
READUPDATEX, which is called by the backup process to receive messages from
the primary process through $RECEIVE.
REPLYX, which is called by the backup process to reply to messages it receives.
WRITEX, which is called by the primary process to send messages to the backup
process.
Message Declarations
The program uses four message formats: two defined by the operating system and
two defined by the program:
CPU_DOWN is a system message that indicates that a monitored CPU is down.
This message is used to notify the backup process, if the primary process CPU
fails, so that the backup process can take over processing.
PROCESS_DELETION is a system message that indicates that a process has
terminated. This message is used to notify the backup process, if the primary
process terminates, so that the backup process can take over processing.