char tmp;
struct lttng_poll_event events;
- DBG("Thread manage kernel started");
+ DBG("[thread] Thread manage kernel started");
- testpoint(thread_manage_kernel);
+ if (testpoint(thread_manage_kernel)) {
+ goto error_testpoint;
+ }
health_code_update(&health_thread_kernel);
- testpoint(thread_manage_kernel_before_loop);
-
ret = create_thread_poll_set(&events, 2);
if (ret < 0) {
goto error_poll_create;
goto error;
}
+ if (testpoint(thread_manage_kernel_before_loop)) {
+ goto error;
+ }
+
while (1) {
health_code_update(&health_thread_kernel);
error:
lttng_poll_clean(&events);
error_poll_create:
+error_testpoint:
utils_close_pipe(kernel_poll_pipe);
kernel_poll_pipe[0] = kernel_poll_pipe[1] = -1;
if (err) {
restart:
health_poll_update(&consumer_data->health);
- testpoint(thread_manage_consumer);
+ if (testpoint(thread_manage_consumer)) {
+ goto error;
+ }
ret = lttng_poll_wait(&events, -1);
health_poll_update(&consumer_data->health);
DBG("[thread] Manage application started");
- testpoint(thread_manage_apps);
-
rcu_register_thread();
rcu_thread_online();
+ if (testpoint(thread_manage_apps)) {
+ goto error_testpoint;
+ }
+
health_code_update(&health_thread_app_manage);
ret = create_thread_poll_set(&events, 2);
goto error;
}
- testpoint(thread_manage_apps_before_loop);
+ if (testpoint(thread_manage_apps_before_loop)) {
+ goto error;
+ }
health_code_update(&health_thread_app_manage);
error:
lttng_poll_clean(&events);
error_poll_create:
+error_testpoint:
utils_close_pipe(apps_cmd_pipe);
apps_cmd_pipe[0] = apps_cmd_pipe[1] = -1;
DBG("[thread] Manage application registration started");
- testpoint(thread_registration_apps);
+ if (testpoint(thread_registration_apps)) {
+ goto error_testpoint;
+ }
ret = lttcomm_listen_unix_sock(apps_sock);
if (ret < 0) {
lttng_poll_clean(&events);
error_listen:
error_create_poll:
+error_testpoint:
DBG("UST Registration thread cleanup complete");
health_exit(&health_thread_app_reg);
DBG("[thread] Manage client started");
- testpoint(thread_manage_clients);
-
rcu_register_thread();
+ if (testpoint(thread_manage_clients)) {
+ goto error_testpoint;
+ }
+
health_code_update(&health_thread_cmd);
ret = lttcomm_listen_unix_sock(client_sock);
kill(ppid, SIGUSR1);
}
- testpoint(thread_manage_clients_before_loop);
+ if (testpoint(thread_manage_clients_before_loop)) {
+ goto error;
+ }
health_code_update(&health_thread_cmd);
error_listen:
error_create_poll:
+error_testpoint:
unlink(client_unix_sock_path);
if (client_sock >= 0) {
ret = close(client_sock);
/*
* Testpoint is only active if the global lttng_testpoint_activated flag is
* set.
+ * Return a non-zero error code to indicate failure.
*/
-#define testpoint(name) \
- do { \
- if (caa_unlikely(lttng_testpoint_activated)) { \
- __testpoint_##name##_wrapper(); \
- } \
- } while (0)
+#define testpoint(name) \
+ ((caa_unlikely(lttng_testpoint_activated)) \
+ ? __testpoint_##name##_wrapper() : 0)
/*
* One wrapper per testpoint is generated. This is to keep track of the symbol
* lookup status and the corresponding function pointer, if any.
*/
#define _TESTPOINT_DECL(_name) \
- static inline void __testpoint_##_name##_wrapper(void) \
+ static inline int __testpoint_##_name##_wrapper(void) \
{ \
- static void (*tp)(void); \
+ int ret = 0; \
+ static int (*tp)(void); \
static int found; \
const char *tp_name = "__testpoint_" #_name; \
\
if (tp) { \
- tp(); \
+ ret = tp(); \
} else { \
if (!found) { \
tp = lttng_testpoint_lookup(tp_name); \
if (tp) { \
found = 1; \
- tp(); \
+ ret = tp(); \
} else { \
found = -1; \
} \
} \
} \
+ return ret; \
}
/* Testpoint declaration */
return 0;
}
-void __testpoint_thread_manage_clients(void)
+int __testpoint_thread_manage_clients(void)
{
const char *var = "LTTNG_THREAD_MANAGE_CLIENTS_EXIT";
if (check_env_var(var)) {
pthread_exit(NULL);
}
+
+ return 0;
}
-void __testpoint_thread_registration_apps(void)
+int __testpoint_thread_registration_apps(void)
{
const char *var = "LTTNG_THREAD_REG_APPS_EXIT";
if (check_env_var(var)) {
pthread_exit(NULL);
}
+
+ return 0;
}
-void __testpoint_thread_manage_apps(void)
+int __testpoint_thread_manage_apps(void)
{
const char *var = "LTTNG_THREAD_MANAGE_APPS_EXIT";
if (check_env_var(var)) {
pthread_exit(NULL);
}
+
+ return 0;
}
-void __testpoint_thread_manage_kernel(void)
+int __testpoint_thread_manage_kernel(void)
{
const char *var = "LTTNG_THREAD_MANAGE_KERNEL_EXIT";
if (check_env_var(var)) {
pthread_exit(NULL);
}
+
+ return 0;
}
-void __testpoint_thread_manage_consumer(void)
+int __testpoint_thread_manage_consumer(void)
{
const char *var = "LTTNG_THREAD_MANAGE_CONSUMER_EXIT";
if (check_env_var(var)) {
pthread_exit(NULL);
}
+
+ return 0;
}
return 0;
}
-void __testpoint_thread_manage_clients_before_loop(void)
+int __testpoint_thread_manage_clients_before_loop(void)
{
const char *var = "LTTNG_THREAD_MANAGE_CLIENTS_STALL";
sleep_time = sleep(sleep_time);
}
}
+
+ return 0;
}
-void __testpoint_thread_manage_kernel_before_loop(void)
+int __testpoint_thread_manage_kernel_before_loop(void)
{
const char *var = "LTTNG_THREAD_MANAGE_KERNEL_STALL";
sleep_time = sleep(sleep_time);
}
}
+
+ return 0;
}
-void __testpoint_thread_manage_apps_before_loop(void)
+int __testpoint_thread_manage_apps_before_loop(void)
{
const char *var = "LTTNG_THREAD_MANAGE_APPS_STALL";
sleep_time = sleep(sleep_time);
}
}
+
+ return 0;
}