CODE EXAMPLE 1-1 System Watchdog Node Management Code Example (Continued)
print_errmsg(gettext(err_msg[EM_GETPVALBYNAME]), picl_strerror(err));
return (err);
}
/*
*check to see if the controller is of interest, otherwise
*move to the next controller.
*/
if (strcmp(cntrl_name,
return (PICL_WALK_CONTINUE);
}
count++;
/* change the
picl2errno(err));
}
return (err);
}
/*
*Function is used to disarm/arm the watchdog controller
*/
static int
control_wd(char *cntrl_name, char *op)
{
wdadm_args_t wd_arg; int err = PICL_SUCCESS;
if (cntrl_name == NULL op == NULL) {
(void) fprintf(stderr, "%s:Invalid arguments\n", prog); return (PICL_INVALIDARG);
}
wd_arg.name = cntrl_name; wd_arg.op = op; wd_arg.error_code = 1;
err = picl_walk_tree_by_class(rooth, PICL_WATCHDOG_CONTROLLER, (void *)&wd_arg, wd_change_state);
if (count == 0) {
(void) fprintf(stderr, "%s:Invalid controller name\n", prog);
return (PICL_NODENOTFOUND);
}
Chapter 1 Watchdog Timer 17