Writing Monitors for the Event Monitoring Service (December 1999)

38 Chapter2
The EMS Application Programming Interface (API)
Function Descriptions
rm_get
Used by resource monitors and target applications to retrieve data from
an object. The caller passes the object and field identifier of interest, and
rm_get() uses the supplied address to store the data.
Function Prototype
int rm_get ( const rm_object_addr obj,
rm_field_type field,
void *addr,
rm_error_type *error_code );
Parameters
addr
An address where the result will be stored. Note that addr is
always specified as the address of a variable. The type of the variable
must match the TYPE specified in the chapters, “Creating a Resource
Monitor” or “Writing a Target Application.
For example, to retrieve the message tag from a Monitor Request object,
a resource monitor should set addr to the address of an unsigned 32-bit
integer.
ubit32 msg_tag;
rm_error_type error_code;
rm_get(obj, RmMsgTag, &msg_tag, &error_code);
To retrieve the resource name from a Subclass Request object, the
monitor should set addr to the address of a character pointer, not the
address of a character array.
The following example correctly sets a character pointer to point to the
resource name:
char *resource_name;
rm_error_type error_code;
rm_get(obj, RmResourceName, &resource_name,
&error_code); /* CORRECT */
Following is an incorrect example of getting a resource name:
char resource_name[256];
rm_error_type error_code;
rm_get(obj, RmResourceName, resource_name,
&error_code); /* WRONG */
error_code
Provides additional information about failure conditions of