Writing Monitors for the Event Monitoring Service (December 1999)

118 Chapter3
Creating a Resource Monitor
Processing a Resource Update Event
rc = rm_set(obj, RmResourceValue, &value, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
}
else {
/***********************************************************************/
/* This case would be used if the resource name was not what we */
/* expected. */
/***********************************************************************/
rc = rm_set(obj, RmResourceType, RM_ERROR_TYPE, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
}
/*************************************************************************/
/* Let the Resource Monitor API decide whether to send a notification */
/* message. */
/*************************************************************************/
rm_print(obj);
rc = rm_notify(obj, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_notify“, error_code);
return -1;
}
return 0;
} /* end update_resource */