procmgr_value_notify_add()

Add an event to be triggered when a monitored value crosses a trigger point

Synopsis:

#include <sys/procmgr.h>

int procmgr_value_notify_add( unsigned type,
                              int sub_id,
                              uint64_t value,
                              const struct sigevent *event );

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Arguments:

type
The type of event you want to add; one of the following:
  • PROCMGR_VALUE_FREE_MEM—the amount of system free memory
  • PROCMGR_VALUE_PRIVATE_MEM—the amount of MAP_PRIVATE memory for a process

You can OR this with one of the following:

  • PROCMGR_VALUE_TRIGGER_UP—deliver the event when the value rises to the trigger point
  • PROCMGR_VALUE_TRIGGER_DOWN—deliver the event when the value drops to the trigger point
sub_id
A sub-ID associated with the type:
  • For PROCMGR_VALUE_FREE_MEM, specify 0 for the total memory, or 1 for resident memory.
  • For PROCMGR_VALUE_PRIVATE_MEM, specify the process ID of the process.
value
The trigger point.
event
A pointer to the sigevent that you want to be delivered.

Description:

The procmgr_value_notify_add() function sets up an event to be triggered when the value being monitored crosses the trigger point up (PROCMGR_VALUE_TRIGGER_UP) or down (PROCMGR_VALUE_TRIGGER_DOWN).

For example, PROCMGR_VALUE_FREE_MEM | PROCMGR_VALUE_TRIGGER_DOWN causes the event to be delivered when the system free memory drops to the specified trigger value.

If you just want to read the value with procmgr_value_current(), don't specify either of the trigger bits.

To delete the notification, call procmgr_event_notify_delete(), passing it the ID that procmgr_value_notify_add() returns.

Returns:

An event ID, or -1 if there was an error (errno is set).

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes