Writing Monitors for the Event Monitoring Service (December 1999)

Chapter 3 91
Creating a Resource Monitor
Processing a Subclass Request Event
rc = rm_set(obj, RmDescription, “This resource instance returns random value
s between 0 and 11,\ninclusive.”, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
}
else if (strcmp(resource_name, “/samples/ubit32”) == 0) {
/*************************************************************************/
/* The “ubit32” resource instance is an unsigned 32-bit integer resource.*/
/*************************************************************************/
rc = rm_set(obj, RmResourceType, RM_UBIT32_TYPE, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
rc = rm_set(obj, RmDescription, “This resource instance returns the current
time as the\nnumber of seconds since January 1, 1970.”, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
}
else if (strcmp(resource_name, “/samples/float”) == 0) {
/*************************************************************************/
/* The “float” resource instance is a 64-bit floating-point resource. */
/*************************************************************************/
rc = rm_set(obj, RmResourceType, RM_FLOAT64_TYPE, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
rc = rm_set(obj, RmDescription, “This resource instance returns various floa
ting-point values.”, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
}
else if (strcmp(resource_name, “/samples/enum”) == 0) {