beautypg.com

Sun Microsystems Netra CP2500 User Manual

Page 23

background image

Chapter 1

Watchdog Timer

9

/* read the property value */

if ((err = picl_get_propval(proph, *vbuf, pinfo.size)) !=

PICL_SUCCESS) {

return (err);

}

return (PICL_SUCCESS);

}

/*

* This function is used to set the value of a picl property

*/

static picl_errno_t

wdadm_set_picl_prop(picl_nodehdl_t nodeh, const char *prop_name,

void *vbuf, int size)

{

picl_errno_t err;

picl_propinfo_t pinfo;

picl_prophdl_t proph;

void *tmp_buf;

if ((err = picl_get_propinfo_by_name(nodeh, prop_name,

&pinfo, &proph)) != PICL_SUCCESS) {

return (err);

}

tmp_buf = alloca(pinfo.size);

if (tmp_buf == NULL) {

return (PICL_NOSPACE);

}

if (size > pinfo.size) {

return (PICL_VALUETOOBIG);

}

bzero(tmp_buf, pinfo.size);

(void) memcpy(tmp_buf, vbuf, size);

/* set the property value */

if ((err = picl_set_propval(proph, vbuf, pinfo.size)) !=

PICL_SUCCESS) {

return (err);

}

return (PICL_SUCCESS);

}

/*

* This function prints the timeout, state, action of a

* watchdog-timer node

CODE EXAMPLE 1-1

System Watchdog Node Management Code Example (Continued)