docs: Add supported versions and fix-backport policy
[lttng-tools.git] / src / bin / lttng-sessiond / event-notifier-error-accounting.hpp
CommitLineData
90aa04a1
FD
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
28f23191 11#include "ust-app.hpp"
533a90fb 12
90aa04a1
FD
13#include <lttng/trigger/trigger.h>
14
28f23191 15#include <stdint.h>
533a90fb 16
90aa04a1
FD
17enum 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,
533a90fb 23 EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD,
783db316 24 EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_UNSUPPORTED,
90aa04a1
FD
25};
26
761ffce2
FD
27/*
28 * Initialize the event notifier error accounting system.
29 * `buffer_size_kernel` and `buffer_size_ust` represent the number of buckets
30 * to be allocated for each domain.
31 */
90aa04a1 32enum event_notifier_error_accounting_status
28f23191 33event_notifier_error_accounting_init(uint64_t buffer_size_kernel, uint64_t buffer_size_ust);
90aa04a1 34
761ffce2
FD
35/*
36 * Register the kernel event notifier group.
37 * This allocates the counter object on the kernel side.
38 */
90aa04a1 39enum event_notifier_error_accounting_status
28f23191 40event_notifier_error_accounting_register_kernel(int kernel_event_notifier_group_fd);
90aa04a1 41
533a90fb 42#ifdef HAVE_LIBLTTNG_UST_CTL
761ffce2
FD
43
44/*
45 * Register a UST application.
46 *
47 * This reuses (or creates) the counter object of the app UID.
48 */
533a90fb
FD
49enum event_notifier_error_accounting_status
50event_notifier_error_accounting_register_app(struct ust_app *app);
51
761ffce2
FD
52/*
53 * Unregister a UST application.
54 */
533a90fb
FD
55enum event_notifier_error_accounting_status
56event_notifier_error_accounting_unregister_app(struct ust_app *app);
f46376a1 57
533a90fb 58#else /* HAVE_LIBLTTNG_UST_CTL */
f46376a1 59
28f23191
JG
60static inline enum event_notifier_error_accounting_status
61event_notifier_error_accounting_register_app(struct ust_app *app __attribute__((unused)))
533a90fb
FD
62{
63 return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
64}
65
28f23191
JG
66static inline enum event_notifier_error_accounting_status
67event_notifier_error_accounting_unregister_app(struct ust_app *app __attribute__((unused)))
533a90fb
FD
68{
69 return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
70}
71#endif /* HAVE_LIBLTTNG_UST_CTL */
72
761ffce2
FD
73/*
74 * Allocates, reserves and returns the error counter index for that trigger.
75 */
90aa04a1 76enum event_notifier_error_accounting_status
28f23191
JG
77event_notifier_error_accounting_register_event_notifier(const struct lttng_trigger *trigger,
78 uint64_t *error_counter_index);
90aa04a1
FD
79
80enum event_notifier_error_accounting_status
28f23191 81event_notifier_error_accounting_get_count(const struct lttng_trigger *trigger, uint64_t *count);
90aa04a1 82
28f23191 83void event_notifier_error_accounting_unregister_event_notifier(const struct lttng_trigger *trigger);
90aa04a1 84
0f4aa1a8 85void event_notifier_error_accounting_fini();
90aa04a1
FD
86
87#endif /* _EVENT_NOTIFIER_ERROR_ACCOUNTING_H */
This page took 0.05592 seconds and 4 git commands to generate.