beautypg.com

Sun Microsystems Netra CP2500 User Manual

Page 24

background image

10

Netra CP2500 Board Programming Guide • March 2007

*/

static picl_errno_t

print_watchdog_node_props(picl_nodehdl_t nodeh)

{

int32_t *timeout = NULL;

char *action = NULL, *status = NULL;

if (wdadm_get_picl_prop(nodeh, WATCHDOG_TIMEOUT,

(void **)&timeout) != PICL_SUCCESS) {

free(timeout);

return (PICL_FAILURE);

}

if (wdadm_get_picl_prop(nodeh, WATCHDOG_STATUS,

(void **)&status) != PICL_SUCCESS) {

free(status);

free(timeout);

return (PICL_FAILURE);

}

if (wdadm_get_picl_prop(nodeh, WATCHDOG_ACTION,

(void **)&action) != PICL_SUCCESS) {

free(status);

free(timeout);

free(action);

return (PICL_FAILURE);

}

(void) printf(PRINT_FORMAT, status, action, *timeout);

free(status);

free(timeout);

free(action);

return (PICL_SUCCESS);

}

/*

* This function is the callback function that gets called

* due to picl_walk_tree_by_class call from print_wd_info function.

* This function traveses all the watchdog-timer nodes under the given

* controller and makes a call to print_watchdog_node_props to print

* the watchdog properties

*/

static int

wd_printf_info(picl_nodehdl_t nodeh, void *args)

{

int err = PICL_SUCCESS;

int print = 0, i = 0;

CODE EXAMPLE 1-1

System Watchdog Node Management Code Example (Continued)