beautypg.com

Sun Microsystems Netra CP2500 User Manual

Page 28

background image

14

Netra CP2500 Board Programming Guide • March 2007

if (strncmp(cntrl_name, wd_arg->name, (ptr - wd_arg->name)) != 0) {

return (PICL_WALK_CONTINUE);

}

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 */

CODE EXAMPLE 1-1

System Watchdog Node Management Code Example (Continued)