beautypg.com

Sun Microsystems Netra CP2500 User Manual

Page 26

background image

12

Netra CP2500 Board Programming Guide • March 2007

if (wd_arg == NULL || print) {

if (count == 0) {

(void) printf("%s", HEADER);

count++;

}

(void) printf("%-30s", name);

(void) print_watchdog_node_props(peerh);

(void) printf("\n");

print = 0;

}

/* move to next timer node */

err = picl_get_propval_by_name(peerh, PICL_PROP_PEER,

&peerh, sizeof (picl_nodehdl_t));

} while (err == PICL_SUCCESS);

return (PICL_WALK_CONTINUE); /* move to next controller */

}

/*

* This routine is used to print the information of watchdog nodes

*/

static int

print_wd_info(int argc, char **argv, int optind)

{

int err = PICL_SUCCESS;

wdadm_args_t *args = NULL;

wdadm_args_t wd_args;

if (argc == optind) {

/* print information of all the nodes */

args = NULL;

} else {

/* print information of only specified nodes */

wd_args.list = argv;

wd_args.start_index = optind;

wd_args.max_index = argc;

args = &wd_args;

}

err = picl_walk_tree_by_class(rooth, PICL_WATCHDOG_CONTROLLER,

(void *)args, wd_printf_info);

if (count == 0) {

(void) fprintf(stderr, "%s:Node not found:%d\n",

prog, picl2errno(PICL_NODENOTFOUND));

return (PICL_NODENOTFOUND);

CODE EXAMPLE 1-1

System Watchdog Node Management Code Example (Continued)