Writing Monitors for the Event Monitoring Service (December 1999)

88 Chapter3
Creating a Resource Monitor
Processing a Subclass Request Event
rc = rm_set(subclass, RmSubclassName, “string”, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
rc = rm_set(obj, RmSubclassChildObject, subclass, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
/***********************************************************************/
/* Define a resource instance called “sbit32”. */
/***********************************************************************/
subclass = rm_create(RM_SUBCLASS_CHILD_OBJECT, &error_code);
if (!subclass) {
rm_perror(“Error in rm_create“, error_code);
return -1;
}
rc = rm_set(subclass, RmSubclassName, “sbit32”, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
rc = rm_set(obj, RmSubclassChildObject, subclass, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
/***********************************************************************/
/* Define a resource instance called “ubit32”. */
/***********************************************************************/
subclass = rm_create(RM_SUBCLASS_CHILD_OBJECT, &error_code);
if (!subclass) {
rm_perror(“Error in rm_create“, error_code);
return -1;
}