Guardian Programmer's Guide

Table Of Contents
Fault-Tolerant Programming in C
Guardian Programmer’s Guide 421922-014
27 - 56
Program Declarations
Two other elements are defined that are used by the backup process if it receives a
message it does not expect: IGNORE_MESSAGE is used as a message number and
is placed in the message number portion of the message structure, and
OWNERSHIP_ERROR is an error value that is returned to the sender.
The message declarations are:
/*message numbers*/
#define CPU_DOWN -2 /*system message*/
#define PROCESS_DELETION -101 /*system message*/
#define UPDATE_OPEN 1 /*application message*/
#define UPDATE_MESSAGE 2 /*application message*/
#define IGNORE_MESSAGE 0 /*used by backup*/
#define OWNERSHIP_ERROR 200 /*used by backup*/
#define IS_BACKUP 6 /*Returned by PROCESS_GETPAIRINFO_ to
indicate whether the current process is
the primary or backup*/
/*The following structure defines the file open info*/
typedef struct
{
/*Input file open state*/
__ns_std_io_file_open_state input_open_info;
/*Output file open state*/
__ns_std_io_file_open_state output_open_info;
} open_info_type;
/*The following structure defines the file state
information.*/
typedef struct
{
__ns_std_io_file_state infile_state; /*Input file state*/
__ns_std_io_file_state outfile_state; /*Output file state*/
__ns_std_io_file_state stdout_state;/*Standard output state*/
} update_info_type;
/*The following structure defines the various message
formats used by this program*/
typedef struct
{
short msgnumber; /*message number*/
union /*one member for each message format*/
{
/*UPDATE_OPEN*/
open_info_type open_info;
/*UPDATE_MESSAGE message*/
update_info_type update_info;