Chapter 1 Watchdog Timer 11
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 = wd_arg->start_index; i < wd_arg->max_index;
i++) {
if (strcmp(wd_arg->list[i], name) == 0) {
print = 1;
break;
}
}
}
CODE EXAMPLE 1-1 System Watchdog Node Management Code Example (Continued)