Hitachi

For Linux(R) (x86) Systems HA Monitor Cluster Software


10.6 Coding example

The following shows a coding example for a UAP.

#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include "HA_mon_uap.h"
 
int main(int argc, char *argv[])
{
 
/*  define variables  */
    int     rt = 0;
    long    rc1 = 1;
    long    rc2 = 1;
    int     signum;
    int     inf;
 
/*  issue the hamon_patrolstart function  */
    signum = SIGUSR2;
    rc1 = hamon_patrolstart(signum, &inf, NULL);
    if(rc1 != 0){
            rt = rc1;
            goto END_OF_FUNC;
    }
    else;
 
    while (1) {
 
            :
            :
         job-processing
            :
            :
    }
 
/*  issue the hamon_patrolstop function  */
    rc2 = hamon_patrolstop(&inf, NULL);
    if(rc2 != 0){
                rt = rc2;
                goto END_OF_FUNC;
    }
    else;
 
    return(rt);
}