Writing Monitors for the Event Monitoring Service (December 1999)

94 Chapter3
Creating a Resource Monitor
Processing a Subclass Request Event
rc = rm_set(state_obj, RmStateName, UNKNOWN_STATE_NAME, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
rc = rm_set(obj, RmStateObject, state_obj, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
}
else {
/***********************************************************************/
/* This is not a resource we support. */
/***********************************************************************/
rc = rm_set(obj, RmResourceType, RM_ERROR_TYPE, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
}
/***************************************************************************/
/* Format the object in the log file. */
/***************************************************************************/
rm_print(obj);
/***************************************************************************/
/* Send the message */
/***************************************************************************/
rc = rm_send_reply(obj, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_send_reply“, error_code);
return -1;
}
return 0;
} /* end send_subclass_reply */