X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fevent-notifier-error-accounting.h;h=d42fff650d8cd5aeaeb7582b65e18910b6c4eaf0;hb=0efb2ad7fc448283184e43d6fb0915febae45384;hp=1dea73948337feb6b19a6eb6ea8ae3558e19df86;hpb=90aa04a116a8be510b9d256b47de6bbb4144fb8b;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/event-notifier-error-accounting.h b/src/bin/lttng-sessiond/event-notifier-error-accounting.h index 1dea73948..d42fff650 100644 --- a/src/bin/lttng-sessiond/event-notifier-error-accounting.h +++ b/src/bin/lttng-sessiond/event-notifier-error-accounting.h @@ -9,23 +9,71 @@ #define _EVENT_NOTIFIER_ERROR_ACCOUNTING_H #include + #include +#include "ust-app.h" + enum event_notifier_error_accounting_status { EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK, EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR, EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NOT_FOUND, EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NOMEM, EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NO_INDEX_AVAILABLE, + EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD, }; +/* + * Initialize the event notifier error accounting system. + * `buffer_size_kernel` and `buffer_size_ust` represent the number of buckets + * to be allocated for each domain. + */ enum event_notifier_error_accounting_status -event_notifier_error_accounting_init(uint64_t nb_bucket); +event_notifier_error_accounting_init(uint64_t buffer_size_kernel, + uint64_t buffer_size_ust); +/* + * Register the kernel event notifier group. + * This allocates the counter object on the kernel side. + */ enum event_notifier_error_accounting_status event_notifier_error_accounting_register_kernel( int kernel_event_notifier_group_fd); +#ifdef HAVE_LIBLTTNG_UST_CTL + +/* + * Register a UST application. + * + * This reuses (or creates) the counter object of the app UID. + */ +enum event_notifier_error_accounting_status +event_notifier_error_accounting_register_app(struct ust_app *app); + +/* + * Unregister a UST application. + */ +enum event_notifier_error_accounting_status +event_notifier_error_accounting_unregister_app(struct ust_app *app); +#else /* HAVE_LIBLTTNG_UST_CTL */ +static inline +enum event_notifier_error_accounting_status +event_notifier_error_accounting_register_app(struct ust_app *app) +{ + return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK; +} + +static inline +enum event_notifier_error_accounting_status +event_notifier_error_accounting_unregister_app(struct ust_app *app) +{ + return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK; +} +#endif /* HAVE_LIBLTTNG_UST_CTL */ + +/* + * Allocates, reserves and returns the error counter index for that trigger. + */ enum event_notifier_error_accounting_status event_notifier_error_accounting_register_event_notifier( const struct lttng_trigger *trigger,