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