Sun Microsystems Netra CP2500 User Manual
Page 31
Chapter 1
Watchdog Timer
17
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, wd_arg->name) != 0) {
return (PICL_WALK_CONTINUE);
}
count++;
/* change the watchdog-controller’s WdOp property */
if ((err = wdadm_set_picl_prop(nodeh, WATCHDOG_OP,
wd_arg->op, strlen(wd_arg->op) + 1)) != PICL_SUCCESS) {
(void) fprintf(stderr, "%s:Failed:%d\n", prog,
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);
}
CODE EXAMPLE 1-1
System Watchdog Node Management Code Example (Continued)