X hits on this document

PDF document

February 10, 2006 - page 208 / 238

1156 views

0 shares

0 downloads

0 comments

208 / 238

196

APPENDIX I. SAMPLE PROGRAM SHOWING EVENT SETUP

printf("Error 0x%x setting thresholds for sensor %s\n", rv, sdata->name); goto out_err; } return;

r out_err: e l e a s e _ s d a t a ( s d a t a ) ;

}

_ _ sensor change(enum ipmi_update e op,

_ ipmi entity_t

*ent,

_ ipmi sensor_t

*sensor,

void

*cb_data)

/* Whenever the status of a sensor changes, the function is called

We display the information of the sensor if we find a new sensor */ static void

{

s d a t a _ t * s d a t a ;

int

rv;

i f ( o p = = I P M I _ A D D E D ) {

sdata = alloc_sdata(sensor); if (!sdata) {

printf("Unable to allocate sensor name memory\n"); return;

}

printf("Sensor added: %s\n", sdata->name);

/* Get the current reading. */ if (ipmi_sensor_get_event_reading_type(sensor) == IPMI_EVENT_READING_TYPE_THRESHOLD) { use_sdata(sdata); rv = ipmi_sensor_get_reading(sensor, got_thresh_reading, sdata); if (rv) { printf("ipmi_reading_get returned error 0x%x for sensor %s\n", rv, sdata->name); release_sdata(sdata);

} } else { use_sdata(sdata); r v = i p m i _ s e n s o r _ g e t _ s t a t e s ( s e n s o r , g o t _ d i s c r e t e _ s t a t e s , s d a t if (rv) { a ) ;

Document info
Document views1156
Page views1156
Page last viewedTue Jan 24 01:59:24 UTC 2017
Pages238
Paragraphs8090
Words85809

Comments