CODE EXAMPLE 1-1 System Watchdog Node Management Code Example (Continued)
#define WATCHDOG_DISARMED | "disarmed" |
/*
*data structure that will be passed as argument to
*picl_walk_tree_by_class callback function
*/
typedef struct {
int start_index; int max_index;
char **list;
char *name;
char *action;
char *op; int32_t timeout;
int error_code; } wdadm_args_t;
static | char |
| *prog; |
static picl_nodehdl_t | rooth; | ||
static |
| int count = 0; |
/*
*Error mesage texts
*/
static char | *err_msg[] = { |
|
|
|
/* program usage */ |
|
|
| |
USAGE_STR, | /* 0 */ | |||
/* picl call failed messages */ |
|
|
| |
"picl_initialize failed: %s\n", | /* | 1 | */ | |
"picl_get_root failed: %s\n", | /* | 2 | */ | |
"picl_get_propval_by_name failed: %s\n" | /* | 3 | */ | |
}; |
|
|
|
|
#define NUM_ERROR_CODES 7
/* mapping between picl error codes and errno */ static int error_map[][2] = {
{PICL_SUCCESS, 0}, { PICL_FAILURE,
static int picl2errno(int piclerr)
{
int i;
for (i = 0; i < NUM_ERROR_CODES; i++) { if (error_map[i][0] == piclerr)
return (error_map[i][1]);
Chapter 1 Watchdog Timer 7