Sun Microsystems CP2500 manual Code Example 1-1System Watchdog Node Management Code Example

Models: CP2500

1 74
Download 74 pages 27.58 Kb
Page 23
Image 23

CODE EXAMPLE 1-1System Watchdog Node Management Code Example (Continued)

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

Chapter 1 Watchdog Timer 9

Page 23
Image 23
Sun Microsystems CP2500 manual Code Example 1-1System Watchdog Node Management Code Example