beautypg.com

Sun Microsystems Netra CP2500 User Manual

Page 29

background image

Chapter 1

Watchdog Timer

15

if (wd_arg->action)

if ((err = wdadm_set_picl_prop(peerh, WATCHDOG_ACTION,

wd_arg->action,

strlen(wd_arg->action) + 1)) != PICL_SUCCESS) {

(void) fprintf(stderr, "%s:Error in "

"setting action:%d\n", prog,

picl2errno(err));

return (err);

}

/* set watchdog timeout */

if (wd_arg->timeout != ILLEGAL_TIMEOUT)

if ((err = wdadm_set_picl_prop(peerh, WATCHDOG_TIMEOUT,

(void *)&wd_arg->timeout,

sizeof (wd_arg->timeout))) !=

PICL_SUCCESS) {

(void) fprintf(stderr, "%s:Error in "

"setting timeout:%d\n", prog,

picl2errno(err));

return (err);

}

return (PICL_WALK_TERMINATE);

}

err = picl_get_propval_by_name(peerh, PICL_PROP_PEER,

&peerh, sizeof (picl_nodehdl_t));

} while (err == PICL_SUCCESS);

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

prog, picl2errno(PICL_NODENOTFOUND));

return (PICL_NODENOTFOUND);

}

/*

* This routine gets called to change the watchdog timeout and

* action.

* wd_name is of "controller:watchdog-timer" format

*/

static int

set_wd_params(char *wd_name, char *action, char *timeout)

{

int err = PICL_SUCCESS;

char *ptr = NULL;

wdadm_args_t wd_arg;

if (wd_name == NULL) {

return (PICL_INVALIDARG);

}

CODE EXAMPLE 1-1

System Watchdog Node Management Code Example (Continued)