Commit | Line | Data |
---|---|---|
6b5133f2 | 1 | /* |
9d16b343 MJ |
2 | * Copyright (C) 2012 Christian Babeux <christian.babeux@efficios.com> |
3 | * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
6b5133f2 | 4 | * |
9d16b343 | 5 | * SPDX-License-Identifier: GPL-2.0-only |
6b5133f2 | 6 | * |
6b5133f2 CB |
7 | */ |
8 | ||
9 | #include <stdlib.h> | |
10 | #include <string.h> | |
11 | #include <pthread.h> | |
a33d2d4a | 12 | #include <urcu.h> |
6b5133f2 CB |
13 | |
14 | /* | |
15 | * Check if the specified environment variable is set. | |
16 | * Return 1 if set, otherwise 0. | |
17 | */ | |
a33d2d4a | 18 | static |
6b5133f2 CB |
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 | ||
a33d2d4a MD |
31 | /* Session daemon */ |
32 | ||
a674fd7e | 33 | int __testpoint_sessiond_thread_manage_clients(void); |
e547b070 | 34 | int __testpoint_sessiond_thread_manage_clients(void) |
6b5133f2 | 35 | { |
e547b070 | 36 | const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CLIENTS_TP_FAIL"; |
6b5133f2 CB |
37 | |
38 | if (check_env_var(var)) { | |
39 | return 1; | |
40 | } | |
41 | ||
42 | return 0; | |
43 | } | |
44 | ||
a674fd7e | 45 | int __testpoint_sessiond_thread_registration_apps(void); |
a33d2d4a MD |
46 | int __testpoint_sessiond_thread_registration_apps(void) |
47 | { | |
48 | const char *var = "LTTNG_SESSIOND_THREAD_REG_APPS_TP_FAIL"; | |
49 | ||
50 | if (check_env_var(var)) { | |
51 | return 1; | |
52 | } | |
53 | ||
54 | return 0; | |
55 | } | |
56 | ||
a674fd7e | 57 | int __testpoint_sessiond_thread_manage_apps(void); |
e547b070 | 58 | int __testpoint_sessiond_thread_manage_apps(void) |
6b5133f2 | 59 | { |
e547b070 | 60 | const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_APPS_TP_FAIL"; |
6b5133f2 CB |
61 | |
62 | if (check_env_var(var)) { | |
63 | return 1; | |
64 | } | |
65 | ||
66 | return 0; | |
67 | } | |
68 | ||
a674fd7e | 69 | int __testpoint_sessiond_thread_manage_kernel(void); |
e547b070 | 70 | int __testpoint_sessiond_thread_manage_kernel(void) |
6b5133f2 | 71 | { |
e547b070 | 72 | const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_KERNEL_TP_FAIL"; |
6b5133f2 CB |
73 | |
74 | if (check_env_var(var)) { | |
75 | return 1; | |
76 | } | |
77 | ||
78 | return 0; | |
79 | } | |
a33d2d4a | 80 | |
a674fd7e | 81 | int __testpoint_sessiond_thread_manage_consumer(void); |
a33d2d4a MD |
82 | int __testpoint_sessiond_thread_manage_consumer(void) |
83 | { | |
84 | const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CONSUMER_TP_FAIL"; | |
85 | ||
86 | if (check_env_var(var)) { | |
87 | return 1; | |
88 | } | |
89 | ||
90 | return 0; | |
91 | } | |
92 | ||
a674fd7e | 93 | int __testpoint_sessiond_thread_ht_cleanup(void); |
a33d2d4a MD |
94 | int __testpoint_sessiond_thread_ht_cleanup(void) |
95 | { | |
96 | const char *var = "LTTNG_SESSIOND_THREAD_HT_CLEANUP_TP_FAIL"; | |
97 | ||
98 | if (check_env_var(var)) { | |
99 | return 1; | |
100 | } | |
101 | ||
102 | return 0; | |
103 | } | |
104 | ||
a674fd7e | 105 | int __testpoint_sessiond_thread_app_manage_notify(void); |
a33d2d4a MD |
106 | int __testpoint_sessiond_thread_app_manage_notify(void) |
107 | { | |
108 | const char *var = "LTTNG_SESSIOND_THREAD_APP_MANAGE_NOTIFY_TP_FAIL"; | |
109 | ||
110 | if (check_env_var(var)) { | |
111 | return 1; | |
112 | } | |
113 | ||
114 | return 0; | |
115 | } | |
116 | ||
a674fd7e | 117 | int __testpoint_sessiond_thread_app_reg_dispatch(void); |
a33d2d4a MD |
118 | int __testpoint_sessiond_thread_app_reg_dispatch(void) |
119 | { | |
120 | const char *var = "LTTNG_SESSIOND_THREAD_APP_REG_DISPATCH_TP_FAIL"; | |
121 | ||
122 | if (check_env_var(var)) { | |
123 | return 1; | |
124 | } | |
125 | ||
126 | return 0; | |
127 | } | |
128 | ||
129 | /* Consumer daemon */ | |
130 | ||
a674fd7e | 131 | int __testpoint_consumerd_thread_channel(void); |
a33d2d4a MD |
132 | int __testpoint_consumerd_thread_channel(void) |
133 | { | |
134 | const char *var = "LTTNG_CONSUMERD_THREAD_CHANNEL_TP_FAIL"; | |
135 | ||
136 | if (check_env_var(var)) { | |
137 | return 1; | |
138 | } | |
139 | ||
140 | return 0; | |
141 | } | |
142 | ||
a674fd7e | 143 | int __testpoint_consumerd_thread_metadata(void); |
a33d2d4a MD |
144 | int __testpoint_consumerd_thread_metadata(void) |
145 | { | |
146 | const char *var = "LTTNG_CONSUMERD_THREAD_METADATA_TP_FAIL"; | |
147 | ||
148 | if (check_env_var(var)) { | |
149 | return 1; | |
150 | } | |
151 | ||
152 | return 0; | |
153 | } | |
154 | ||
a674fd7e | 155 | int __testpoint_consumerd_thread_data(void); |
a33d2d4a MD |
156 | int __testpoint_consumerd_thread_data(void) |
157 | { | |
158 | const char *var = "LTTNG_CONSUMERD_THREAD_DATA_TP_FAIL"; | |
159 | ||
160 | if (check_env_var(var)) { | |
161 | return 1; | |
162 | } | |
163 | ||
164 | return 0; | |
165 | } | |
166 | ||
a674fd7e | 167 | int __testpoint_consumerd_thread_sessiond(void); |
a33d2d4a MD |
168 | int __testpoint_consumerd_thread_sessiond(void) |
169 | { | |
170 | const char *var = "LTTNG_CONSUMERD_THREAD_SESSIOND_TP_FAIL"; | |
171 | ||
172 | if (check_env_var(var)) { | |
173 | return 1; | |
174 | } | |
175 | ||
176 | return 0; | |
177 | } | |
178 | ||
a674fd7e | 179 | int __testpoint_consumerd_thread_metadata_timer(void); |
a33d2d4a MD |
180 | int __testpoint_consumerd_thread_metadata_timer(void) |
181 | { | |
182 | const char *var = "LTTNG_CONSUMERD_THREAD_METADATA_TIMER_TP_FAIL"; | |
183 | ||
184 | if (check_env_var(var)) { | |
185 | return 1; | |
186 | } | |
187 | ||
188 | return 0; | |
189 | } | |
190 | ||
191 | /* Relay daemon */ | |
192 | ||
a674fd7e | 193 | int __testpoint_relayd_thread_dispatcher(void); |
a33d2d4a MD |
194 | int __testpoint_relayd_thread_dispatcher(void) |
195 | { | |
196 | const char *var = "LTTNG_RELAYD_THREAD_DISPATCHER_TP_FAIL"; | |
197 | ||
198 | if (check_env_var(var)) { | |
199 | return 1; | |
200 | } | |
201 | ||
202 | return 0; | |
203 | } | |
204 | ||
a674fd7e | 205 | int __testpoint_relayd_thread_worker(void); |
a33d2d4a MD |
206 | int __testpoint_relayd_thread_worker(void) |
207 | { | |
208 | const char *var = "LTTNG_RELAYD_THREAD_WORKER_TP_FAIL"; | |
209 | ||
210 | if (check_env_var(var)) { | |
211 | return 1; | |
212 | } | |
213 | ||
214 | return 0; | |
215 | } | |
216 | ||
a674fd7e | 217 | int __testpoint_relayd_thread_listener(void); |
a33d2d4a MD |
218 | int __testpoint_relayd_thread_listener(void) |
219 | { | |
220 | const char *var = "LTTNG_RELAYD_THREAD_LISTENER_TP_FAIL"; | |
221 | ||
222 | if (check_env_var(var)) { | |
223 | return 1; | |
224 | } | |
225 | ||
226 | return 0; | |
227 | } | |
228 | ||
a674fd7e | 229 | int __testpoint_relayd_thread_live_dispatcher(void); |
a33d2d4a MD |
230 | int __testpoint_relayd_thread_live_dispatcher(void) |
231 | { | |
232 | const char *var = "LTTNG_RELAYD_THREAD_LIVE_DISPATCHER_TP_FAIL"; | |
233 | ||
234 | if (check_env_var(var)) { | |
235 | return 1; | |
236 | } | |
237 | ||
238 | return 0; | |
239 | } | |
240 | ||
a674fd7e | 241 | int __testpoint_relayd_thread_live_worker(void); |
a33d2d4a MD |
242 | int __testpoint_relayd_thread_live_worker(void) |
243 | { | |
244 | const char *var = "LTTNG_RELAYD_THREAD_LIVE_WORKER_TP_FAIL"; | |
245 | ||
246 | if (check_env_var(var)) { | |
247 | return 1; | |
248 | } | |
249 | ||
250 | return 0; | |
251 | } | |
252 | ||
a674fd7e | 253 | int __testpoint_relayd_thread_live_listener(void); |
a33d2d4a MD |
254 | int __testpoint_relayd_thread_live_listener(void) |
255 | { | |
256 | const char *var = "LTTNG_RELAYD_THREAD_LIVE_LISTENER_TP_FAIL"; | |
257 | ||
258 | if (check_env_var(var)) { | |
259 | return 1; | |
260 | } | |
261 | ||
262 | return 0; | |
263 | } |