CODE EXAMPLE 1-1 System Watchdog Node Management Code Example (Continued)
wdadm_args_t *wd_arg = NULL; picl_nodehdl_t childh, peerh;
char cntrl_name[PICL_PROPNAMELEN_MAX]; char wd_name[PICL_PROPNAMELEN_MAX]; char name[2 * PICL_PROPNAMELEN_MAX];
wd_arg = (wdadm_args_t *)args;
/* get the controller name */
err = picl_get_propval_by_name(nodeh, PICL_PROP_NAME, (void *)cntrl_name, PICL_PROPNAMELEN_MAX);
if (err != PICL_SUCCESS) { print_errmsg(gettext(err_msg[EM_GETPVALBYNAME]),
picl_strerror(err)); return (err);
}
/* get the first child of controller */
err = picl_get_propval_by_name(nodeh, PICL_PROP_CHILD, &childh, sizeof (picl_nodehdl_t));
if (err != PICL_SUCCESS) /* This controller has no childs */ return (PICL_WALK_CONTINUE); /* move to next controller */
peerh = childh;
/* traverse thru all the timer nodes using peer property. */ 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);
}
(void) sprintf(name, "%s:%s", cntrl_name, wd_name);
if (wd_arg != NULL) {
/* check if the node is in the list to print */ for (i =
i++) {
if
break;
}
}
}
Chapter 1 Watchdog Timer 11