CODE EXAMPLE 1-1 System Watchdog Node Management Code Example (Continued)
if (strncmp(cntrl_name,
}
err = picl_get_propval_by_name(nodeh, PICL_PROP_CHILD, &childh, sizeof (picl_nodehdl_t));
if (err != PICL_SUCCESS)
return (PICL_WALK_TERMINATE);
ptr++; /* this points to watchdog node name */ if (ptr == NULL) {
(void) fprintf(stderr, "%s:Node not found:%d\n", prog, picl2errno(PICL_NODENOTFOUND));
return (PICL_WALK_TERMINATE);
}
/* traverse thru the list of timers under this controller */ peerh = childh;
do
{
/* get the name of watchdog node */
err = picl_get_propval_by_name(peerh, PICL_PROP_NAME, (void *)wd_name, PICL_PROPNAMELEN_MAX);
if (err != PICL_SUCCESS) { print_errmsg(gettext(err_msg[EM_GETPVALBYNAME]),
picl_strerror(err)); return (err);
}
/* This code segment changes the watchdog timeout and action */ if (strcmp(ptr, wd_name) == 0) {
if ((err = wdadm_get_picl_prop(peerh, WATCHDOG_STATUS, (void **)&status)) != PICL_SUCCESS) {
(void) free(status); return (err);
}
if (strcmp(status, WATCHDOG_DISARMED) != 0) { (void) fprintf(stderr, "%s: Timer is not "
"disarmed, cannot change the " "parameters\n", prog);
(void) free(status); return (PICL_PERMDENIED);
}
(void) free(status);
/* set watchdog action */