Add sessiond/SESSIOND_ prefix to sessiond testpoints
[lttng-tools.git] / tests / regression / tools / health / health_exit.c
CommitLineData
9e32c5c0
CB
1/*
2 * Copyright (C) 2012 - Christian Babeux <christian.babeux@efficios.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18#include <stdlib.h>
19#include <string.h>
20#include <pthread.h>
7f2a8058 21#include <urcu.h>
9e32c5c0
CB
22
23/*
24 * Check if the specified environment variable is set.
25 * Return 1 if set, otherwise 0.
26 */
27int check_env_var(const char *env)
28{
29 if (env) {
30 char *env_val = getenv(env);
31 if (env_val && (strncmp(env_val, "1", 1) == 0)) {
32 return 1;
33 }
34 }
35
36 return 0;
37}
38
e547b070 39int __testpoint_sessiond_thread_manage_clients(void)
9e32c5c0 40{
e547b070 41 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CLIENTS_EXIT";
9e32c5c0
CB
42
43 if (check_env_var(var)) {
7f2a8058 44 rcu_unregister_thread();
9e32c5c0
CB
45 pthread_exit(NULL);
46 }
6993eeb3
CB
47
48 return 0;
9e32c5c0
CB
49}
50
e547b070 51int __testpoint_sessiond_thread_registration_apps(void)
9e32c5c0 52{
e547b070 53 const char *var = "LTTNG_SESSIOND_THREAD_REG_APPS_EXIT";
9e32c5c0
CB
54
55 if (check_env_var(var)) {
56 pthread_exit(NULL);
57 }
6993eeb3
CB
58
59 return 0;
9e32c5c0
CB
60}
61
e547b070 62int __testpoint_sessiond_thread_manage_apps(void)
9e32c5c0 63{
e547b070 64 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_APPS_EXIT";
9e32c5c0
CB
65
66 if (check_env_var(var)) {
7f2a8058 67 rcu_unregister_thread();
9e32c5c0
CB
68 pthread_exit(NULL);
69 }
6993eeb3
CB
70
71 return 0;
9e32c5c0
CB
72}
73
e547b070 74int __testpoint_sessiond_thread_manage_kernel(void)
9e32c5c0 75{
e547b070 76 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_KERNEL_EXIT";
9e32c5c0
CB
77
78 if (check_env_var(var)) {
79 pthread_exit(NULL);
80 }
6993eeb3
CB
81
82 return 0;
9e32c5c0
CB
83}
84
e547b070 85int __testpoint_sessiond_thread_manage_consumer(void)
9e32c5c0 86{
e547b070 87 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CONSUMER_EXIT";
9e32c5c0
CB
88
89 if (check_env_var(var)) {
90 pthread_exit(NULL);
91 }
6993eeb3
CB
92
93 return 0;
9e32c5c0 94}
This page took 0.050033 seconds and 5 git commands to generate.