SoW-2019-0002: Dynamic Snapshot
[lttng-tools.git] / tests / regression / tools / health / health_exit.c
1 /*
2 * Copyright (C) 2012 Christian Babeux <christian.babeux@efficios.com>
3 * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 */
8
9 #include <stdlib.h>
10 #include <string.h>
11 #include <pthread.h>
12 #include <urcu.h>
13
14 /*
15 * Check if the specified environment variable is set.
16 * Return 1 if set, otherwise 0.
17 */
18 static
19 int check_env_var(const char *env)
20 {
21 if (env) {
22 char *env_val = getenv(env);
23 if (env_val && (strncmp(env_val, "1", 1) == 0)) {
24 return 1;
25 }
26 }
27
28 return 0;
29 }
30
31 /* Session daemon */
32
33 int __testpoint_sessiond_thread_manage_clients(void);
34 int __testpoint_sessiond_thread_manage_clients(void)
35 {
36 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CLIENTS_EXIT";
37
38 if (check_env_var(var)) {
39 rcu_unregister_thread();
40 pthread_exit(NULL);
41 }
42
43 return 0;
44 }
45
46 int __testpoint_sessiond_thread_registration_apps(void);
47 int __testpoint_sessiond_thread_registration_apps(void)
48 {
49 const char *var = "LTTNG_SESSIOND_THREAD_REG_APPS_EXIT";
50
51 if (check_env_var(var)) {
52 pthread_exit(NULL);
53 }
54
55 return 0;
56 }
57
58 int __testpoint_sessiond_thread_manage_apps(void);
59 int __testpoint_sessiond_thread_manage_apps(void)
60 {
61 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_APPS_EXIT";
62
63 if (check_env_var(var)) {
64 rcu_unregister_thread();
65 pthread_exit(NULL);
66 }
67
68 return 0;
69 }
70
71 int __testpoint_sessiond_thread_manage_kernel(void);
72 int __testpoint_sessiond_thread_manage_kernel(void)
73 {
74 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_KERNEL_EXIT";
75
76 if (check_env_var(var)) {
77 pthread_exit(NULL);
78 }
79
80 return 0;
81 }
82
83 int __testpoint_sessiond_thread_manage_consumer(void);
84 int __testpoint_sessiond_thread_manage_consumer(void)
85 {
86 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CONSUMER_EXIT";
87
88 if (check_env_var(var)) {
89 pthread_exit(NULL);
90 }
91
92 return 0;
93 }
94
95 int __testpoint_sessiond_thread_ht_cleanup(void);
96 int __testpoint_sessiond_thread_ht_cleanup(void)
97 {
98 const char *var = "LTTNG_SESSIOND_THREAD_HT_CLEANUP_EXIT";
99
100 if (check_env_var(var)) {
101 rcu_unregister_thread();
102 pthread_exit(NULL);
103 }
104
105 return 0;
106 }
107
108 int __testpoint_sessiond_thread_app_manage_notify(void);
109 int __testpoint_sessiond_thread_app_manage_notify(void)
110 {
111 const char *var = "LTTNG_SESSIOND_THREAD_APP_MANAGE_NOTIFY_EXIT";
112
113 if (check_env_var(var)) {
114 rcu_unregister_thread();
115 pthread_exit(NULL);
116 }
117
118 return 0;
119 }
120
121 int __testpoint_sessiond_thread_app_reg_dispatch(void);
122 int __testpoint_sessiond_thread_app_reg_dispatch(void)
123 {
124 const char *var = "LTTNG_SESSIOND_THREAD_APP_REG_DISPATCH_EXIT";
125
126 if (check_env_var(var)) {
127 pthread_exit(NULL);
128 }
129
130 return 0;
131 }
132
133 /* Consumer daemon */
134
135 int __testpoint_consumerd_thread_channel(void);
136 int __testpoint_consumerd_thread_channel(void)
137 {
138 const char *var = "LTTNG_CONSUMERD_THREAD_CHANNEL_EXIT";
139
140 if (check_env_var(var)) {
141 rcu_unregister_thread();
142 pthread_exit(NULL);
143 }
144
145 return 0;
146 }
147
148 int __testpoint_consumerd_thread_metadata(void);
149 int __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
161 int __testpoint_consumerd_thread_data(void);
162 int __testpoint_consumerd_thread_data(void)
163 {
164 const char *var = "LTTNG_CONSUMERD_THREAD_DATA_EXIT";
165
166 if (check_env_var(var)) {
167 rcu_unregister_thread();
168 pthread_exit(NULL);
169 }
170
171 return 0;
172 }
173
174 int __testpoint_consumerd_thread_sessiond(void);
175 int __testpoint_consumerd_thread_sessiond(void)
176 {
177 const char *var = "LTTNG_CONSUMERD_THREAD_SESSIOND_EXIT";
178
179 if (check_env_var(var)) {
180 rcu_unregister_thread();
181 pthread_exit(NULL);
182 }
183
184 return 0;
185 }
186
187 int __testpoint_consumerd_thread_metadata_timer(void);
188 int __testpoint_consumerd_thread_metadata_timer(void)
189 {
190 const char *var = "LTTNG_CONSUMERD_THREAD_METADATA_TIMER_EXIT";
191
192 if (check_env_var(var)) {
193 pthread_exit(NULL);
194 }
195
196 return 0;
197 }
198
199 /* Relay daemon */
200
201 int __testpoint_relayd_thread_dispatcher(void);
202 int __testpoint_relayd_thread_dispatcher(void)
203 {
204 const char *var = "LTTNG_RELAYD_THREAD_DISPATCHER_EXIT";
205
206 if (check_env_var(var)) {
207 pthread_exit(NULL);
208 }
209
210 return 0;
211 }
212
213 int __testpoint_relayd_thread_worker(void);
214 int __testpoint_relayd_thread_worker(void)
215 {
216 const char *var = "LTTNG_RELAYD_THREAD_WORKER_EXIT";
217
218 if (check_env_var(var)) {
219 rcu_unregister_thread();
220 pthread_exit(NULL);
221 }
222
223 return 0;
224 }
225
226 int __testpoint_relayd_thread_listener(void);
227 int __testpoint_relayd_thread_listener(void)
228 {
229 const char *var = "LTTNG_RELAYD_THREAD_LISTENER_EXIT";
230
231 if (check_env_var(var)) {
232 pthread_exit(NULL);
233 }
234
235 return 0;
236 }
237
238 int __testpoint_relayd_thread_live_dispatcher(void);
239 int __testpoint_relayd_thread_live_dispatcher(void)
240 {
241 const char *var = "LTTNG_RELAYD_THREAD_LIVE_DISPATCHER_EXIT";
242
243 if (check_env_var(var)) {
244 pthread_exit(NULL);
245 }
246
247 return 0;
248 }
249
250 int __testpoint_relayd_thread_live_worker(void);
251 int __testpoint_relayd_thread_live_worker(void)
252 {
253 const char *var = "LTTNG_RELAYD_THREAD_LIVE_WORKER_EXIT";
254
255 if (check_env_var(var)) {
256 rcu_unregister_thread();
257 pthread_exit(NULL);
258 }
259
260 return 0;
261 }
262
263 int __testpoint_relayd_thread_live_listener(void);
264 int __testpoint_relayd_thread_live_listener(void)
265 {
266 const char *var = "LTTNG_RELAYD_THREAD_LIVE_LISTENER_EXIT";
267
268 if (check_env_var(var)) {
269 pthread_exit(NULL);
270 }
271
272 return 0;
273 }
This page took 0.053949 seconds and 6 git commands to generate.