Writing Monitors for the Event Monitoring Service (December 1999)
90 Chapter3
Creating a Resource Monitor
Processing a Subclass Request Event
rc = rm_set(obj, RmSubclassChildObject, subclass, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
}
/***************************************************************************/
/* Also check the resource instances for a match. */
/***************************************************************************/
else if (strcmp(resource_name, “/samples/string”) == 0) {
/*************************************************************************/
/* The “string” resource instance is a character string. */
/*************************************************************************/
rc = rm_set(obj, RmResourceType, RM_STRING_TYPE, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
rc = rm_set(obj, RmDescription, “This resource returns a string that is the
current time.”, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
}
else if (strcmp(resource_name, “/samples/sbit32”) == 0) {
/*************************************************************************/
/* The “sbit32” resource instance is a signed 32-bit integer resource. */
/*************************************************************************/
rc = rm_set(obj, RmResourceType, RM_SBIT32_TYPE, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}