docs: Add supported versions and fix-backport policy
[lttng-tools.git] / include / lttng / health.h
CommitLineData
d74df422
MD
1#ifndef LTTNG_HEALTH_H
2#define LTTNG_HEALTH_H
3
4/*
ab5be9fa
MJ
5 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
6 * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
d74df422 7 *
ab5be9fa 8 * SPDX-License-Identifier: LGPL-2.1-only
d74df422 9 *
d74df422
MD
10 */
11
4bd69c5f
SM
12#include <lttng/lttng-export.h>
13
2c1142ac
JG
14#ifdef __cplusplus
15extern "C" {
16#endif
17
d74df422
MD
18struct lttng_health;
19struct lttng_health_thread;
20
21enum lttng_health_consumerd {
22 LTTNG_HEALTH_CONSUMERD_UST_32,
23 LTTNG_HEALTH_CONSUMERD_UST_64,
24 LTTNG_HEALTH_CONSUMERD_KERNEL,
6c71277b
MD
25
26 NR_LTTNG_HEALTH_CONSUMERD,
d74df422
MD
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 */
4bd69c5f 34LTTNG_EXPORT extern struct lttng_health *lttng_health_create_sessiond(void);
d74df422
MD
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 */
4bd69c5f 42LTTNG_EXPORT extern struct lttng_health *
28f23191 43lttng_health_create_consumerd(enum lttng_health_consumerd consumerd);
d74df422
MD
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 */
4bd69c5f 54LTTNG_EXPORT extern struct lttng_health *lttng_health_create_relayd(const char *path);
d74df422
MD
55
56/**
57 * lttng_health_destroy - Destroy health object
58 * @health: health object to destroy
59 */
4bd69c5f 60LTTNG_EXPORT extern void lttng_health_destroy(struct lttng_health *health);
d74df422
MD
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 */
4bd69c5f 70LTTNG_EXPORT extern int lttng_health_query(struct lttng_health *health);
d74df422
MD
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 */
4bd69c5f 83LTTNG_EXPORT extern int lttng_health_state(const struct lttng_health *health);
d74df422
MD
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 */
4bd69c5f 92LTTNG_EXPORT extern int lttng_health_get_nr_threads(const struct lttng_health *health);
d74df422
MD
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 */
4bd69c5f 103LTTNG_EXPORT extern const struct lttng_health_thread *
28f23191 104lttng_health_get_thread(const struct lttng_health *health, unsigned int nth_thread);
d74df422
MD
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 */
4bd69c5f 112LTTNG_EXPORT extern int lttng_health_thread_state(const struct lttng_health_thread *thread);
d74df422
MD
113
114/**
115 * lttng_health_thread_name - Get thread name
116 * @thread: thread health
117 *
118 * Return thread name, NULL on error.
119 */
4bd69c5f 120LTTNG_EXPORT extern const char *lttng_health_thread_name(const struct lttng_health_thread *thread);
d74df422 121
2c1142ac
JG
122#ifdef __cplusplus
123}
124#endif
125
d74df422 126#endif /* LTTNG_HEALTH_H */
This page took 0.056416 seconds and 4 git commands to generate.