Fix: sessiond: rotation thread: fatal error when not finding a session
[lttng-tools.git] / src / bin / lttng-sessiond / event-notifier-error-accounting.h
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 EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_UNSUPPORTED,
25 };
26
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 */
32 enum event_notifier_error_accounting_status
33 event_notifier_error_accounting_init(uint64_t buffer_size_kernel,
34 uint64_t buffer_size_ust);
35
36 /*
37 * Register the kernel event notifier group.
38 * This allocates the counter object on the kernel side.
39 */
40 enum event_notifier_error_accounting_status
41 event_notifier_error_accounting_register_kernel(
42 int kernel_event_notifier_group_fd);
43
44 #ifdef HAVE_LIBLTTNG_UST_CTL
45
46 /*
47 * Register a UST application.
48 *
49 * This reuses (or creates) the counter object of the app UID.
50 */
51 enum event_notifier_error_accounting_status
52 event_notifier_error_accounting_register_app(struct ust_app *app);
53
54 /*
55 * Unregister a UST application.
56 */
57 enum event_notifier_error_accounting_status
58 event_notifier_error_accounting_unregister_app(struct ust_app *app);
59 #else /* HAVE_LIBLTTNG_UST_CTL */
60 static inline
61 enum event_notifier_error_accounting_status
62 event_notifier_error_accounting_register_app(struct ust_app *app)
63 {
64 return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
65 }
66
67 static inline
68 enum event_notifier_error_accounting_status
69 event_notifier_error_accounting_unregister_app(struct ust_app *app)
70 {
71 return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
72 }
73 #endif /* HAVE_LIBLTTNG_UST_CTL */
74
75 /*
76 * Allocates, reserves and returns the error counter index for that trigger.
77 */
78 enum event_notifier_error_accounting_status
79 event_notifier_error_accounting_register_event_notifier(
80 const struct lttng_trigger *trigger,
81 uint64_t *error_counter_index);
82
83 enum event_notifier_error_accounting_status
84 event_notifier_error_accounting_get_count(
85 const struct lttng_trigger *trigger,
86 uint64_t *count);
87
88 void event_notifier_error_accounting_unregister_event_notifier(
89 const struct lttng_trigger *trigger);
90
91 void event_notifier_error_accounting_fini(void);
92
93 #endif /* _EVENT_NOTIFIER_ERROR_ACCOUNTING_H */
This page took 0.02997 seconds and 4 git commands to generate.