5 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
6 * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 * SPDX-License-Identifier: LGPL-2.1-only
17 struct lttng_health_thread
;
19 enum lttng_health_consumerd
{
20 LTTNG_HEALTH_CONSUMERD_UST_32
,
21 LTTNG_HEALTH_CONSUMERD_UST_64
,
22 LTTNG_HEALTH_CONSUMERD_KERNEL
,
24 NR_LTTNG_HEALTH_CONSUMERD
,
28 * lttng_health_create_sessiond - Create sessiond health object
30 * Return a newly allocated health object, or NULL on error.
32 extern struct lttng_health
*lttng_health_create_sessiond(void);
35 * lttng_health_create_consumerd - Create consumerd health object
36 * @consumerd: consumer daemon identifier
38 * Return a newly allocated health object, or NULL on error.
40 extern struct lttng_health
*
41 lttng_health_create_consumerd(enum lttng_health_consumerd consumerd
);
44 * lttng_health_create_relayd - Create relayd health object
45 * @path: path to relay daemon health socket.
47 * "path" needs to refer to a local unix socket file matching the file
48 * used by the relay daemon to query.
50 * Return a newly allocated health object, or NULL on error.
52 extern struct lttng_health
*lttng_health_create_relayd(const char *path
);
55 * lttng_health_destroy - Destroy health object
56 * @health: health object to destroy
58 extern void lttng_health_destroy(struct lttng_health
*health
);
61 * lttng_health_query - Query component health
62 * @health: health state (input/output).
64 * Return 0 on success, negative value on error. This return value only
65 * reports if the query has been successfully performed, *NOT* the
66 * actual state. lttng_health_state() should be used for the latter.
68 extern int lttng_health_query(struct lttng_health
*health
);
71 * lttng_health_state - Inspect the state of a health structure
72 * @health: health state (input).
74 * "path" needs to refer to a local unix socket file matching the file
75 * used by the relay daemon to query.
77 * Return 0 on success, negative value if the component has at least one
78 * thread in error. It also returns a negative return value if
79 * lttng_health_query() has not yet successfully completed on @health.
81 extern int lttng_health_state(const struct lttng_health
*health
);
84 * lttng_health_get_nr_threads - Get number of threads in health component
85 * @health: health state (input)
87 * Return the number of threads (>= 0) on success, else negative value
90 extern int lttng_health_get_nr_threads(const struct lttng_health
*health
);
93 * lttng_health_get_thread - Get thread health
94 * @health: health state (input)
95 * @nth_thread: nth thread to lookup
97 * Return a pointer to the health thread, else NULL on error. This
98 * pointer should not be freed by the caller, and can be used until
99 * lttng_health_destroy() is called on @health.
101 extern const struct lttng_health_thread
*
102 lttng_health_get_thread(const struct lttng_health
*health
,
103 unsigned int nth_thread
);
106 * lttng_health_thread_state - Get thread health state
107 * @thread: thread health
109 * Return 0 if thread is OK, else negative error value.
111 extern int lttng_health_thread_state(const struct lttng_health_thread
*thread
);
114 * lttng_health_thread_name - Get thread name
115 * @thread: thread health
117 * Return thread name, NULL on error.
119 extern const char *lttng_health_thread_name(const struct lttng_health_thread
*thread
);
125 #endif /* LTTNG_HEALTH_H */