![]() |
LTTng control library C API
|

Data Structures | |
| struct | lttng_endpoint |
| LTTng endpoint (opaque type). More... | |
| struct | lttng_notification |
| Notification (opaque type). More... | |
| struct | lttng_notification_channel |
| Notification channel (opaque type). More... | |
Enumerations | |
| enum | lttng_notification_channel_status { LTTNG_NOTIFICATION_CHANNEL_STATUS_OK , LTTNG_NOTIFICATION_CHANNEL_STATUS_NOTIFICATIONS_DROPPED , LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED , LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR , LTTNG_NOTIFICATION_CHANNEL_STATUS_CLOSED , LTTNG_NOTIFICATION_CHANNEL_STATUS_ALREADY_SUBSCRIBED , LTTNG_NOTIFICATION_CHANNEL_STATUS_UNKNOWN_CONDITION , LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID , LTTNG_NOTIFICATION_CHANNEL_STATUS_UNSUPPORTED_VERSION } |
| Return type of notification channel API functions. More... | |
Functions | |
| struct lttng_notification_channel * | lttng_notification_channel_create (struct lttng_endpoint *endpoint) |
Creates a notification channel, connecting to the endpoint endpoint, without any subscription. | |
| void | lttng_notification_channel_destroy (struct lttng_notification_channel *channel) |
Destroys the notification channel channel. | |
| enum lttng_notification_channel_status | lttng_notification_channel_get_next_notification (struct lttng_notification_channel *channel, struct lttng_notification **notification) |
Blocks the current thread until the next notification is available from the notification channel channel and sets *notification accordingly. | |
| enum lttng_notification_channel_status | lttng_notification_channel_has_pending_notification (struct lttng_notification_channel *channel, bool *notification_avail) |
Sets *notification_avail to whether or not the notification channel channel has an available notification to get. | |
| enum lttng_notification_channel_status | lttng_notification_channel_subscribe (struct lttng_notification_channel *channel, const struct lttng_condition *condition) |
Makes the notification channel channel subscribe to the notifications which LTTng sends when a trigger having the condition condition fires. | |
| enum lttng_notification_channel_status | lttng_notification_channel_unsubscribe (struct lttng_notification_channel *channel, const struct lttng_condition *condition) |
Makes the notification channel channel unsubscribe from the notifications which LTTng sends when a trigger having the condition condition fires. | |
| void | lttng_notification_destroy (struct lttng_notification *notification) |
Destroys the notification notification. | |
| const struct lttng_condition * | lttng_notification_get_condition (struct lttng_notification *notification) |
Returns the condition which caused a trigger to send the notification notification. | |
| const struct lttng_evaluation * | lttng_notification_get_evaluation (struct lttng_notification *notification) |
Returns the evaluation of the condition which caused a trigger to send the notification notification. | |
| const struct lttng_trigger * | lttng_notification_get_trigger (struct lttng_notification *notification) |
Returns the trigger which fired to make LTTng send the notification notification. | |
Variables | |
| struct lttng_endpoint * | lttng_session_daemon_notification_endpoint |
| LTTng session daemon notification endpoint. | |
A notification channel is a special connection to an LTTng session daemon with which you subscribe to notifications which LTTng sends when specific trigger conditions are satisfied.
LTTng sends a notification to subscribed notification channels when it executes a “notify” trigger action.
To use a notification channel:
Create a notification channel with lttng_notification_channel_create().
This call establishes a dedicated, persistent connection with an LTTng session daemon.
Call lttng_notification_channel_get_next_notification() to block the current thread until the channel receives a new notification. Repeat as needed.
You may also call the non-blocking lttng_notification_channel_has_pending_notification() function to check whether or not lttng_notification_channel_get_next_notification() would return immediately.
With a notification object in hand, you may get:
The evaluation of the satisfied trigger condition with lttng_notification_get_evaluation().
This object contains values which LTTng captured when the trigger fired.
When you're done with the notification, destroy it with lttng_notification_destroy().
During the lifetime of the notification channel, you may call lttng_notification_channel_subscribe() and lttng_notification_channel_unsubscribe() as you will to modify its subscriptions.
Return type of notification channel API functions.
| Enumerator | |
|---|---|
| LTTNG_NOTIFICATION_CHANNEL_STATUS_OK | Success. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_NOTIFICATIONS_DROPPED | Notification was dropped/discarded. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED | Woken up by a signal. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR | Error. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_CLOSED | Connection closed. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_ALREADY_SUBSCRIBED | Already subscribed. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_UNKNOWN_CONDITION | Unknown trigger condition. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID | Unsatisfied precondition. |
|
extern |
Creates a notification channel, connecting to the endpoint endpoint, without any subscription.
| [in] | endpoint | Endpoint to connect to: must be exactly lttng_session_daemon_notification_endpoint. |
Notification channel on success, or NULL on error.
Destroy the returned notification channel with lttng_notification_channel_destroy().
endpoint is lttng_session_daemon_notification_endpoint.
|
extern |
Destroys the notification channel channel.
| [in] | channel | Notification channel to destroy. May be |
|
extern |
Blocks the current thread until the next notification is available from the notification channel channel and sets *notification accordingly.
To avoid blocking when calling this function, check if a notification is available first with lttng_notification_channel_has_pending_notification().
| [in] | channel | Notification channel from which to get the next notification. |
| [out] | notification | On success, this function sets Destroy the returned notification with lttng_notification_destroy(). |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_OK | Success. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_NOTIFICATIONS_DROPPED | One or more notifications were dropped because the client couldn't keep up. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED | The blocking wait was interrupted by a signal. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID | Unsatisfied precondition. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR | Other error. |
channel is not NULL.notification is not NULL.
|
extern |
Sets *notification_avail to whether or not the notification channel channel has an available notification to get.
Unlike lttng_notification_channel_get_next_notification(), this function doesn't block the current thread.
| [in] | channel | Notification channel to check. |
| [out] | notification_avail | On success, this function sets
|
| LTTNG_NOTIFICATION_CHANNEL_STATUS_OK | Success. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_CLOSED | The connection of the notification channel is closed. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID | Unsatisfied precondition. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR | Other error. |
channel is not NULL.notification_avail is not NULL.
|
extern |
Makes the notification channel channel subscribe to the notifications which LTTng sends when a trigger having the condition condition fires.
When a trigger having a condition exactly equal to condition and a “notify” action fires, LTTng sends a notification to the notification channel channel.
Reverse this subscription and stop receiving notifications with lttng_notification_channel_unsubscribe().
You may only call this function once with a given trigger condition without first calling lttng_notification_channel_unsubscribe() with it.
| [in] | channel | Notification channel to which to add a subscription. |
| [in] | condition | Trigger condition which must be satisfied for LTTng to send the notifications to subscribe to (not moved). |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_OK | Success. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_ALREADY_SUBSCRIBED | This function was already called with channel and condition without first calling lttng_notification_channel_unsubscribe() (double subscription). |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID | Unsatisfied precondition. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR | Other error. |
channel is not NULL.condition is not NULL.
|
extern |
Makes the notification channel channel unsubscribe from the notifications which LTTng sends when a trigger having the condition condition fires.
You may only call this function if you already called lttng_notification_channel_subscribe() with the same parameters.
| [in] | channel | Notification channel from which to remove a subscription. |
| [in] | condition | Trigger condition which must be satisfied for LTTng to send the notifications to unsubscribe from (not moved). |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_OK | Success. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_UNKNOWN_CONDITION | lttng_notification_channel_subscribe() wasn't called with the same parameters first (no subscription). |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID | Unsatisfied precondition. |
| LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR | Other error. |
channel is not NULL.condition is not NULL.
|
extern |
Destroys the notification notification.
| [in] | notification | Notification to destroy. May be |
|
extern |
Returns the condition which caused a trigger to send the notification notification.
| [in] | notification | Notification of which to get the satisfied trigger condition. |
Satisfied trigger condition which caused a trigger to send notification, or NULL on error.
notification owns the returned trigger condition.
The returned trigger condition remains valid as long as notification exists.
notification is not NULL.
|
extern |
Returns the evaluation of the condition which caused a trigger to send the notification notification.
A trigger condition evaluation contains values which LTTng captured when the trigger fired.
| [in] | notification | Notification of which to get the evaluation of the satisfied trigger condition. |
Evaluation of the satisfied trigger condition which caused a trigger to send notification, or NULL on error.
notification owns the returned trigger condition evaluation.
The returned trigger condition evaluation remains valid as long as notification exists.
notification is not NULL.
|
extern |
Returns the trigger which fired to make LTTng send the notification notification.
| [in] | notification | Notification of which to get the firing trigger. |
Trigger which fired, making LTTng send notification, or NULL on error.
notification owns the returned trigger.
The returned trigger remains valid as long as notification exists.
notification is not NULL.
|
extern |
LTTng session daemon notification endpoint.
This endpoint follows the typical session daemon connection procedure.
The purpose of this endpoint is to create a notification channel with lttng_notification_channel_create().