docs: Add supported versions and fix-backport policy
[lttng-tools.git] / include / lttng / health.h
1 #ifndef LTTNG_HEALTH_H
2 #define LTTNG_HEALTH_H
3
4 /*
5 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
6 * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 *
8 * SPDX-License-Identifier: LGPL-2.1-only
9 *
10 */
11
12 #include <lttng/lttng-export.h>
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 struct lttng_health;
19 struct lttng_health_thread;
20
21 enum lttng_health_consumerd {
22 LTTNG_HEALTH_CONSUMERD_UST_32,
23 LTTNG_HEALTH_CONSUMERD_UST_64,
24 LTTNG_HEALTH_CONSUMERD_KERNEL,
25
26 NR_LTTNG_HEALTH_CONSUMERD,
27 };
28
29 /**
30 * lttng_health_create_sessiond - Create sessiond health object
31 *
32 * Return a newly allocated health object, or NULL on error.
33 */
34 LTTNG_EXPORT extern struct lttng_health *lttng_health_create_sessiond(void);
35
36 /**
37 * lttng_health_create_consumerd - Create consumerd health object
38 * @consumerd: consumer daemon identifier
39 *
40 * Return a newly allocated health object, or NULL on error.
41 */
42 LTTNG_EXPORT extern struct lttng_health *
43 lttng_health_create_consumerd(enum lttng_health_consumerd consumerd);
44
45 /**
46 * lttng_health_create_relayd - Create relayd health object
47 * @path: path to relay daemon health socket.
48 *
49 * "path" needs to refer to a local unix socket file matching the file
50 * used by the relay daemon to query.
51 *
52 * Return a newly allocated health object, or NULL on error.
53 */
54 LTTNG_EXPORT extern struct lttng_health *lttng_health_create_relayd(const char *path);
55
56 /**
57 * lttng_health_destroy - Destroy health object
58 * @health: health object to destroy
59 */
60 LTTNG_EXPORT extern void lttng_health_destroy(struct lttng_health *health);
61
62 /**
63 * lttng_health_query - Query component health
64 * @health: health state (input/output).
65 *
66 * Return 0 on success, negative value on error. This return value only
67 * reports if the query has been successfully performed, *NOT* the
68 * actual state. lttng_health_state() should be used for the latter.
69 */
70 LTTNG_EXPORT extern int lttng_health_query(struct lttng_health *health);
71
72 /**
73 * lttng_health_state - Inspect the state of a health structure
74 * @health: health state (input).
75 *
76 * "path" needs to refer to a local unix socket file matching the file
77 * used by the relay daemon to query.
78 *
79 * Return 0 on success, negative value if the component has at least one
80 * thread in error. It also returns a negative return value if
81 * lttng_health_query() has not yet successfully completed on @health.
82 */
83 LTTNG_EXPORT extern int lttng_health_state(const struct lttng_health *health);
84
85 /**
86 * lttng_health_get_nr_threads - Get number of threads in health component
87 * @health: health state (input)
88 *
89 * Return the number of threads (>= 0) on success, else negative value
90 * on error.
91 */
92 LTTNG_EXPORT extern int lttng_health_get_nr_threads(const struct lttng_health *health);
93
94 /**
95 * lttng_health_get_thread - Get thread health
96 * @health: health state (input)
97 * @nth_thread: nth thread to lookup
98 *
99 * Return a pointer to the health thread, else NULL on error. This
100 * pointer should not be freed by the caller, and can be used until
101 * lttng_health_destroy() is called on @health.
102 */
103 LTTNG_EXPORT extern const struct lttng_health_thread *
104 lttng_health_get_thread(const struct lttng_health *health, unsigned int nth_thread);
105
106 /**
107 * lttng_health_thread_state - Get thread health state
108 * @thread: thread health
109 *
110 * Return 0 if thread is OK, else negative error value.
111 */
112 LTTNG_EXPORT extern int lttng_health_thread_state(const struct lttng_health_thread *thread);
113
114 /**
115 * lttng_health_thread_name - Get thread name
116 * @thread: thread health
117 *
118 * Return thread name, NULL on error.
119 */
120 LTTNG_EXPORT extern const char *lttng_health_thread_name(const struct lttng_health_thread *thread);
121
122 #ifdef __cplusplus
123 }
124 #endif
125
126 #endif /* LTTNG_HEALTH_H */
This page took 0.030703 seconds and 4 git commands to generate.