health check tests: test relayd and consumerd
[lttng-tools.git] / tests / regression / tools / health / health_exit.c
CommitLineData
9e32c5c0
CB
1/*
2 * Copyright (C) 2012 - Christian Babeux <christian.babeux@efficios.com>
76d96022 3 * Copyright (C) 2014 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9e32c5c0
CB
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License, version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#include <stdlib.h>
20#include <string.h>
21#include <pthread.h>
7f2a8058 22#include <urcu.h>
9e32c5c0
CB
23
24/*
25 * Check if the specified environment variable is set.
26 * Return 1 if set, otherwise 0.
27 */
76d96022 28static
9e32c5c0
CB
29int check_env_var(const char *env)
30{
31 if (env) {
32 char *env_val = getenv(env);
33 if (env_val && (strncmp(env_val, "1", 1) == 0)) {
34 return 1;
35 }
36 }
37
38 return 0;
39}
40
76d96022
MD
41/* Session daemon */
42
71ddb4ed 43int __testpoint_sessiond_thread_manage_clients(void)
9e32c5c0 44{
71ddb4ed 45 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CLIENTS_EXIT";
9e32c5c0
CB
46
47 if (check_env_var(var)) {
7f2a8058 48 rcu_unregister_thread();
9e32c5c0
CB
49 pthread_exit(NULL);
50 }
6993eeb3
CB
51
52 return 0;
9e32c5c0
CB
53}
54
71ddb4ed 55int __testpoint_sessiond_thread_registration_apps(void)
9e32c5c0 56{
71ddb4ed 57 const char *var = "LTTNG_SESSIOND_THREAD_REG_APPS_EXIT";
9e32c5c0
CB
58
59 if (check_env_var(var)) {
60 pthread_exit(NULL);
61 }
6993eeb3
CB
62
63 return 0;
9e32c5c0
CB
64}
65
71ddb4ed 66int __testpoint_sessiond_thread_manage_apps(void)
9e32c5c0 67{
71ddb4ed 68 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_APPS_EXIT";
9e32c5c0
CB
69
70 if (check_env_var(var)) {
7f2a8058 71 rcu_unregister_thread();
9e32c5c0
CB
72 pthread_exit(NULL);
73 }
6993eeb3
CB
74
75 return 0;
9e32c5c0
CB
76}
77
71ddb4ed 78int __testpoint_sessiond_thread_manage_kernel(void)
9e32c5c0 79{
71ddb4ed 80 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_KERNEL_EXIT";
9e32c5c0
CB
81
82 if (check_env_var(var)) {
83 pthread_exit(NULL);
84 }
6993eeb3
CB
85
86 return 0;
9e32c5c0
CB
87}
88
71ddb4ed 89int __testpoint_sessiond_thread_manage_consumer(void)
9e32c5c0 90{
71ddb4ed 91 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CONSUMER_EXIT";
9e32c5c0
CB
92
93 if (check_env_var(var)) {
94 pthread_exit(NULL);
95 }
6993eeb3
CB
96
97 return 0;
9e32c5c0 98}
76d96022
MD
99
100int __testpoint_sessiond_thread_ht_cleanup(void)
101{
102 const char *var = "LTTNG_SESSIOND_THREAD_HT_CLEANUP_EXIT";
103
104 if (check_env_var(var)) {
105 rcu_unregister_thread();
106 pthread_exit(NULL);
107 }
108
109 return 0;
110}
111
112int __testpoint_sessiond_thread_app_manage_notify(void)
113{
114 const char *var = "LTTNG_SESSIOND_THREAD_APP_MANAGE_NOTIFY_EXIT";
115
116 if (check_env_var(var)) {
117 rcu_unregister_thread();
118 pthread_exit(NULL);
119 }
120
121 return 0;
122}
123
124int __testpoint_sessiond_thread_app_reg_dispatch(void)
125{
126 const char *var = "LTTNG_SESSIOND_THREAD_APP_REG_DISPATCH_EXIT";
127
128 if (check_env_var(var)) {
129 pthread_exit(NULL);
130 }
131
132 return 0;
133}
134
135/* Consumer daemon */
136
137int __testpoint_consumerd_thread_channel(void)
138{
139 const char *var = "LTTNG_CONSUMERD_THREAD_CHANNEL_EXIT";
140
141 if (check_env_var(var)) {
142 rcu_unregister_thread();
143 pthread_exit(NULL);
144 }
145
146 return 0;
147}
148
149int __testpoint_consumerd_thread_metadata(void)
150{
151 const char *var = "LTTNG_CONSUMERD_THREAD_METADATA_EXIT";
152
153 if (check_env_var(var)) {
154 rcu_unregister_thread();
155 pthread_exit(NULL);
156 }
157
158 return 0;
159}
160
161int __testpoint_consumerd_thread_data(void)
162{
163 const char *var = "LTTNG_CONSUMERD_THREAD_DATA_EXIT";
164
165 if (check_env_var(var)) {
166 rcu_unregister_thread();
167 pthread_exit(NULL);
168 }
169
170 return 0;
171}
172
173int __testpoint_consumerd_thread_sessiond(void)
174{
175 const char *var = "LTTNG_CONSUMERD_THREAD_SESSIOND_EXIT";
176
177 if (check_env_var(var)) {
178 rcu_unregister_thread();
179 pthread_exit(NULL);
180 }
181
182 return 0;
183}
184
185int __testpoint_consumerd_thread_metadata_timer(void)
186{
187 const char *var = "LTTNG_CONSUMERD_THREAD_METADATA_TIMER_EXIT";
188
189 if (check_env_var(var)) {
190 pthread_exit(NULL);
191 }
192
193 return 0;
194}
195
196/* Relay daemon */
197
198int __testpoint_relayd_thread_dispatcher(void)
199{
200 const char *var = "LTTNG_RELAYD_THREAD_DISPATCHER_EXIT";
201
202 if (check_env_var(var)) {
203 pthread_exit(NULL);
204 }
205
206 return 0;
207}
208
209int __testpoint_relayd_thread_worker(void)
210{
211 const char *var = "LTTNG_RELAYD_THREAD_WORKER_EXIT";
212
213 if (check_env_var(var)) {
214 rcu_unregister_thread();
215 pthread_exit(NULL);
216 }
217
218 return 0;
219}
220
221int __testpoint_relayd_thread_listener(void)
222{
223 const char *var = "LTTNG_RELAYD_THREAD_LISTENER_EXIT";
224
225 if (check_env_var(var)) {
226 pthread_exit(NULL);
227 }
228
229 return 0;
230}
231
232int __testpoint_relayd_thread_live_dispatcher(void)
233{
234 const char *var = "LTTNG_RELAYD_THREAD_LIVE_DISPATCHER_EXIT";
235
236 if (check_env_var(var)) {
237 pthread_exit(NULL);
238 }
239
240 return 0;
241}
242
243int __testpoint_relayd_thread_live_worker(void)
244{
245 const char *var = "LTTNG_RELAYD_THREAD_LIVE_WORKER_EXIT";
246
247 if (check_env_var(var)) {
248 rcu_unregister_thread();
249 pthread_exit(NULL);
250 }
251
252 return 0;
253}
254
255int __testpoint_relayd_thread_live_listener(void)
256{
257 const char *var = "LTTNG_RELAYD_THREAD_LIVE_LISTENER_EXIT";
258
259 if (check_env_var(var)) {
260 pthread_exit(NULL);
261 }
262
263 return 0;
264}
This page took 0.044954 seconds and 4 git commands to generate.