| 1 | /* |
| 2 | * Copyright (C) 2020 Francis Deslauriers <francis.deslauriers@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef _EVENT_NOTIFIER_ERROR_ACCOUNTING_H |
| 9 | #define _EVENT_NOTIFIER_ERROR_ACCOUNTING_H |
| 10 | |
| 11 | #include <stdint.h> |
| 12 | |
| 13 | #include <lttng/trigger/trigger.h> |
| 14 | |
| 15 | #include "ust-app.h" |
| 16 | |
| 17 | enum event_notifier_error_accounting_status { |
| 18 | EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK, |
| 19 | EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR, |
| 20 | EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NOT_FOUND, |
| 21 | EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NOMEM, |
| 22 | EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NO_INDEX_AVAILABLE, |
| 23 | EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD, |
| 24 | }; |
| 25 | |
| 26 | enum event_notifier_error_accounting_status |
| 27 | event_notifier_error_accounting_init(uint64_t nb_bucket); |
| 28 | |
| 29 | enum event_notifier_error_accounting_status |
| 30 | event_notifier_error_accounting_register_kernel( |
| 31 | int kernel_event_notifier_group_fd); |
| 32 | |
| 33 | #ifdef HAVE_LIBLTTNG_UST_CTL |
| 34 | enum event_notifier_error_accounting_status |
| 35 | event_notifier_error_accounting_register_app(struct ust_app *app); |
| 36 | |
| 37 | enum event_notifier_error_accounting_status |
| 38 | event_notifier_error_accounting_unregister_app(struct ust_app *app); |
| 39 | #else /* HAVE_LIBLTTNG_UST_CTL */ |
| 40 | static inline |
| 41 | enum event_notifier_error_accounting_status |
| 42 | event_notifier_error_accounting_register_app(struct ust_app *app) |
| 43 | { |
| 44 | return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK; |
| 45 | } |
| 46 | |
| 47 | static inline |
| 48 | enum event_notifier_error_accounting_status |
| 49 | event_notifier_error_accounting_unregister_app(struct ust_app *app) |
| 50 | { |
| 51 | return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK; |
| 52 | } |
| 53 | #endif /* HAVE_LIBLTTNG_UST_CTL */ |
| 54 | |
| 55 | enum event_notifier_error_accounting_status |
| 56 | event_notifier_error_accounting_register_event_notifier( |
| 57 | const struct lttng_trigger *trigger, |
| 58 | uint64_t *error_counter_index); |
| 59 | |
| 60 | enum event_notifier_error_accounting_status |
| 61 | event_notifier_error_accounting_get_count( |
| 62 | const struct lttng_trigger *trigger, |
| 63 | uint64_t *count); |
| 64 | |
| 65 | void event_notifier_error_accounting_unregister_event_notifier( |
| 66 | const struct lttng_trigger *trigger); |
| 67 | |
| 68 | void event_notifier_error_accounting_fini(void); |
| 69 | |
| 70 | #endif /* _EVENT_NOTIFIER_ERROR_ACCOUNTING_H */ |