From 8782cc7477fae212607b9fd6395a4b2e2d3357ed Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sun, 15 Sep 2013 16:52:54 -0500 Subject: [PATCH] Turn health.h/health.c into a library All app-specific state is now in an object: struct health_app. This moves the per-application enumeration into health-sessiond.h (for sessiond). Signed-off-by: Mathieu Desnoyers --- src/bin/lttng-sessiond/Makefile.am | 2 +- src/bin/lttng-sessiond/cmd.c | 2 +- src/bin/lttng-sessiond/consumer.c | 2 +- src/bin/lttng-sessiond/health-sessiond.h | 39 +++++++ src/bin/lttng-sessiond/health.c | 123 ++++++++++++++--------- src/bin/lttng-sessiond/health.h | 31 ++---- src/bin/lttng-sessiond/ht-cleanup.c | 6 +- src/bin/lttng-sessiond/kernel-consumer.c | 2 +- src/bin/lttng-sessiond/main.c | 68 +++++++------ src/bin/lttng-sessiond/ust-app.c | 2 +- src/bin/lttng-sessiond/ust-consumer.c | 2 +- src/bin/lttng-sessiond/ust-thread.c | 6 +- tests/unit/Makefile.am | 16 +-- 13 files changed, 186 insertions(+), 115 deletions(-) create mode 100644 src/bin/lttng-sessiond/health-sessiond.h diff --git a/src/bin/lttng-sessiond/Makefile.am b/src/bin/lttng-sessiond/Makefile.am index 77cc1d21b..0fab90f33 100644 --- a/src/bin/lttng-sessiond/Makefile.am +++ b/src/bin/lttng-sessiond/Makefile.am @@ -22,7 +22,7 @@ lttng_sessiond_SOURCES = utils.c utils.h \ fd-limit.c fd-limit.h \ kernel-consumer.c kernel-consumer.h \ consumer.h \ - health.c health.h \ + health.c health.h health-sessiond.h \ cmd.c cmd.h \ buffer-registry.c buffer-registry.h \ testpoint.h ht-cleanup.c \ diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 85f396f1c..670992657 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -30,7 +30,7 @@ #include "channel.h" #include "consumer.h" #include "event.h" -#include "health.h" +#include "health-sessiond.h" #include "kernel.h" #include "kernel-consumer.h" #include "lttng-sessiond.h" diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index 3a500092f..55a2af4f7 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -31,7 +31,7 @@ #include #include "consumer.h" -#include "health.h" +#include "health-sessiond.h" #include "ust-app.h" #include "utils.h" diff --git a/src/bin/lttng-sessiond/health-sessiond.h b/src/bin/lttng-sessiond/health-sessiond.h new file mode 100644 index 000000000..18f922728 --- /dev/null +++ b/src/bin/lttng-sessiond/health-sessiond.h @@ -0,0 +1,39 @@ +#ifndef HEALTH_SESSIOND_H +#define HEALTH_SESSIOND_H + +/* + * Copyright (C) 2012 - David Goulet + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License, version 2 only, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "health.h" + +enum health_type { + HEALTH_TYPE_CMD = 0, + HEALTH_TYPE_APP_MANAGE = 1, + HEALTH_TYPE_APP_REG = 2, + HEALTH_TYPE_KERNEL = 3, + HEALTH_TYPE_CONSUMER = 4, + HEALTH_TYPE_HT_CLEANUP = 5, + HEALTH_TYPE_APP_MANAGE_NOTIFY = 6, + HEALTH_TYPE_APP_REG_DISPATCH = 7, + + HEALTH_NUM_TYPE, +}; + +/* Application health monitoring */ +extern struct health_app *health_sessiond; + +#endif /* HEALTH_SESSIOND_H */ diff --git a/src/bin/lttng-sessiond/health.c b/src/bin/lttng-sessiond/health.c index fafc9095d..7e1d4731a 100644 --- a/src/bin/lttng-sessiond/health.c +++ b/src/bin/lttng-sessiond/health.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 - David Goulet + * Copyright (C) 2013 - Mathieu Desnoyers * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License, version 2 only, as @@ -29,48 +30,76 @@ #include "health.h" -static struct timespec time_delta = { - .tv_sec = DEFAULT_HEALTH_CHECK_DELTA_S, - .tv_nsec = DEFAULT_HEALTH_CHECK_DELTA_NS, +/* + * An application-specific error state for unregistered thread keeps + * track of thread errors. A thread reporting a health error, normally + * unregisters and quits. This makes the TLS health state not available + * to the health_check_state() call so on unregister we update this + * global error array so we can keep track of which thread was on error + * if the TLS health state has been removed. + */ +struct health_app { + /* List of health state, for each application thread */ + struct cds_list_head list; + /* + * This lock ensures that TLS memory used for the node and its + * container structure don't get reclaimed after the TLS owner + * thread exits until we have finished using it. + */ + pthread_mutex_t lock; + int nr_types; + struct timespec time_delta; + /* Health flags containing thread type error state */ + enum health_flags *flags; }; /* Define TLS health state. */ DEFINE_URCU_TLS(struct health_state, health_state); -/* - * It ensures that TLS memory used for the node and its container structure - * don't get reclaimed after the TLS owner thread exits until we have finished - * using it. - */ -static pthread_mutex_t health_mutex = PTHREAD_MUTEX_INITIALIZER; +struct health_app *health_app_create(int nr_types) +{ + struct health_app *ha; -static struct health_tls_state_list health_state_list = { - .head = CDS_LIST_HEAD_INIT(health_state_list.head), -}; + ha = zmalloc(sizeof(*ha)); + if (!ha) { + return NULL; + } + ha->flags = zmalloc(sizeof(*ha->flags)); + if (!ha->flags) { + goto error_flags; + } + CDS_INIT_LIST_HEAD(&ha->list); + pthread_mutex_init(&ha->lock, NULL); + ha->nr_types = nr_types; + ha->time_delta.tv_sec = DEFAULT_HEALTH_CHECK_DELTA_S; + ha->time_delta.tv_nsec = DEFAULT_HEALTH_CHECK_DELTA_NS; + return ha; + +error_flags: + free(ha); + return NULL; +} -/* - * This keeps track of the error state for unregistered thread. A thread - * reporting a health error, normally unregisters and quits. This makes the TLS - * health state not available to the health_check_state() call so on unregister - * we update this global error array so we can keep track of which thread was - * on error if the TLS health state has been removed. - */ -static enum health_flags global_error_state[HEALTH_NUM_TYPE]; +void health_app_destroy(struct health_app *ha) +{ + free(ha->flags); + free(ha); +} /* * Lock health state global list mutex. */ -static void state_lock(void) +static void state_lock(struct health_app *ha) { - pthread_mutex_lock(&health_mutex); + pthread_mutex_lock(&ha->lock); } /* * Unlock health state global list mutex. */ -static void state_unlock(void) +static void state_unlock(struct health_app *ha) { - pthread_mutex_unlock(&health_mutex); + pthread_mutex_unlock(&ha->lock); } /* @@ -113,7 +142,7 @@ static int time_diff_gt(const struct timespec *time_a, * * Return 0 if health is bad or else 1. */ -static int validate_state(struct health_state *state) +static int validate_state(struct health_app *ha, struct health_state *state) { int retval = 1, ret; unsigned long current, last; @@ -152,7 +181,8 @@ static int validate_state(struct health_state *state) state->last = current; memcpy(&state->last_time, ¤t_time, sizeof(current_time)); } else { - if (time_diff_gt(¤t_time, &state->last_time, &time_delta)) { + if (time_diff_gt(¤t_time, &state->last_time, + &ha->time_delta)) { if (current == last && !HEALTH_IS_IN_POLL(current)) { /* error */ retval = 0; @@ -181,23 +211,23 @@ end: * * Return 0 if health is bad or else 1. */ -int health_check_state(enum health_type type) +int health_check_state(struct health_app *ha, int type) { int retval = 1; struct health_state *state; - assert(type < HEALTH_NUM_TYPE); + assert(type < ha->nr_types); - state_lock(); + state_lock(ha); - cds_list_for_each_entry(state, &health_state_list.head, node) { + cds_list_for_each_entry(state, &ha->list, node) { int ret; if (state->type != type) { continue; } - ret = validate_state(state); + ret = validate_state(ha, state); if (!ret) { retval = 0; goto end; @@ -205,12 +235,12 @@ int health_check_state(enum health_type type) } /* Check the global state since some state might not be visible anymore. */ - if (global_error_state[type] & HEALTH_ERROR) { + if (ha->flags[type] & HEALTH_ERROR) { retval = 0; } end: - state_unlock(); + state_unlock(ha); DBG("Health check for type %d is %s", (int) type, (retval == 0) ? "BAD" : "GOOD"); @@ -220,9 +250,9 @@ end: /* * Init health state. */ -void health_register(enum health_type type) +void health_register(struct health_app *ha, int type) { - assert(type < HEALTH_NUM_TYPE); + assert(type < ha->nr_types); /* Init TLS state. */ uatomic_set(&URCU_TLS(health_state).last, 0); @@ -233,41 +263,42 @@ void health_register(enum health_type type) uatomic_set(&URCU_TLS(health_state).type, type); /* Add it to the global TLS state list. */ - state_lock(); - cds_list_add(&URCU_TLS(health_state).node, &health_state_list.head); - state_unlock(); + state_lock(ha); + cds_list_add(&URCU_TLS(health_state).node, &ha->list); + state_unlock(ha); } /* * Remove node from global list. */ -void health_unregister(void) +void health_unregister(struct health_app *ha) { - state_lock(); + state_lock(ha); /* * On error, set the global_error_state since we are about to remove * the node from the global list. */ if (uatomic_read(&URCU_TLS(health_state).flags) & HEALTH_ERROR) { - uatomic_set(&global_error_state[URCU_TLS(health_state).type], + uatomic_set(&ha->flags[URCU_TLS(health_state).type], HEALTH_ERROR); } cds_list_del(&URCU_TLS(health_state).node); - state_unlock(); + state_unlock(ha); } /* * Initiliazie health check subsytem. This should be called before any health * register occurs. */ -void health_init(void) +void health_init(struct health_app *ha) { /* * Get the maximum value between the default delta value and the TCP * timeout with a safety net of the default health check delta. */ - time_delta.tv_sec = max_t(unsigned long, + ha->time_delta.tv_sec = max_t(unsigned long, lttcomm_inet_tcp_timeout + DEFAULT_HEALTH_CHECK_DELTA_S, - time_delta.tv_sec); - DBG("Health check time delta in seconds set to %lu", time_delta.tv_sec); + ha->time_delta.tv_sec); + DBG("Health check time delta in seconds set to %lu", + ha->time_delta.tv_sec); } diff --git a/src/bin/lttng-sessiond/health.h b/src/bin/lttng-sessiond/health.h index ff2c789d8..82cfc87df 100644 --- a/src/bin/lttng-sessiond/health.h +++ b/src/bin/lttng-sessiond/health.h @@ -34,27 +34,12 @@ #define HEALTH_IS_IN_POLL(x) ((x) & HEALTH_POLL_VALUE) +struct health_app; + enum health_flags { HEALTH_ERROR = (1U << 0), }; -enum health_type { - HEALTH_TYPE_CMD = 0, - HEALTH_TYPE_APP_MANAGE = 1, - HEALTH_TYPE_APP_REG = 2, - HEALTH_TYPE_KERNEL = 3, - HEALTH_TYPE_CONSUMER = 4, - HEALTH_TYPE_HT_CLEANUP = 5, - HEALTH_TYPE_APP_MANAGE_NOTIFY = 6, - HEALTH_TYPE_APP_REG_DISPATCH = 7, - - HEALTH_NUM_TYPE, -}; - -struct health_tls_state_list { - struct cds_list_head head; -}; - struct health_state { /* * last counter and last_time are only read and updated by the health_check @@ -68,7 +53,7 @@ struct health_state { */ unsigned long current; /* progress counter, updated atomically */ enum health_flags flags; /* other flags, updated atomically */ - enum health_type type; /* Indicates the nature of the thread. */ + int type; /* Indicates the nature of the thread. */ /* Node of the global TLS state list. */ struct cds_list_head node; }; @@ -121,9 +106,11 @@ static inline void health_error(void) uatomic_or(&URCU_TLS(health_state).flags, HEALTH_ERROR); } -int health_check_state(enum health_type type); -void health_register(enum health_type type); -void health_unregister(void); -void health_init(void); +struct health_app *health_app_create(int nr_types); +void health_app_destroy(struct health_app *ha); +int health_check_state(struct health_app *ha, int type); +void health_register(struct health_app *ha, int type); +void health_unregister(struct health_app *ha); +void health_init(struct health_app *ha); #endif /* _HEALTH_H */ diff --git a/src/bin/lttng-sessiond/ht-cleanup.c b/src/bin/lttng-sessiond/ht-cleanup.c index 7a33840c9..4eb0c0034 100644 --- a/src/bin/lttng-sessiond/ht-cleanup.c +++ b/src/bin/lttng-sessiond/ht-cleanup.c @@ -23,7 +23,7 @@ #include #include "lttng-sessiond.h" -#include "health.h" +#include "health-sessiond.h" void *thread_ht_cleanup(void *data) { @@ -36,7 +36,7 @@ void *thread_ht_cleanup(void *data) rcu_register_thread(); rcu_thread_online(); - health_register(HEALTH_TYPE_HT_CLEANUP); + health_register(health_sessiond, HEALTH_TYPE_HT_CLEANUP); health_code_update(); @@ -132,7 +132,7 @@ error_poll_create: health_error(); ERR("Health error occurred in %s", __func__); } - health_unregister(); + health_unregister(health_sessiond); rcu_thread_offline(); rcu_unregister_thread(); return NULL; diff --git a/src/bin/lttng-sessiond/kernel-consumer.c b/src/bin/lttng-sessiond/kernel-consumer.c index de8fddb97..70759fb36 100644 --- a/src/bin/lttng-sessiond/kernel-consumer.c +++ b/src/bin/lttng-sessiond/kernel-consumer.c @@ -26,7 +26,7 @@ #include #include "consumer.h" -#include "health.h" +#include "health-sessiond.h" #include "kernel-consumer.h" static char *create_channel_path(struct consumer_output *consumer, diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 9d0d01f14..a54c0bf8d 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -60,7 +60,7 @@ #include "ust-consumer.h" #include "utils.h" #include "fd-limit.h" -#include "health.h" +#include "health-sessiond.h" #include "testpoint.h" #include "ust-thread.h" @@ -233,6 +233,9 @@ static int app_socket_timeout; /* Set in main() with the current page size. */ long page_size; +/* Application health monitoring */ +struct health_app *health_sessiond; + static void setup_consumerd_path(void) { @@ -755,7 +758,7 @@ static void *thread_manage_kernel(void *data) DBG("[thread] Thread manage kernel started"); - health_register(HEALTH_TYPE_KERNEL); + health_register(health_sessiond, HEALTH_TYPE_KERNEL); /* * This first step of the while is to clean this structure which could free @@ -880,7 +883,7 @@ error_testpoint: WARN("Kernel thread died unexpectedly. " "Kernel tracing can continue but CPU hotplug is disabled."); } - health_unregister(); + health_unregister(health_sessiond); DBG("Kernel thread dying"); return NULL; } @@ -921,7 +924,7 @@ static void *thread_manage_consumer(void *data) DBG("[thread] Manage consumer started"); - health_register(HEALTH_TYPE_CONSUMER); + health_register(health_sessiond, HEALTH_TYPE_CONSUMER); health_code_update(); @@ -1200,7 +1203,7 @@ error_poll: health_error(); ERR("Health error occurred in %s", __func__); } - health_unregister(); + health_unregister(health_sessiond); DBG("consumer thread cleanup completed"); return NULL; @@ -1220,7 +1223,7 @@ static void *thread_manage_apps(void *data) rcu_register_thread(); rcu_thread_online(); - health_register(HEALTH_TYPE_APP_MANAGE); + health_register(health_sessiond, HEALTH_TYPE_APP_MANAGE); if (testpoint(thread_manage_apps)) { goto error_testpoint; @@ -1366,7 +1369,7 @@ error_testpoint: health_error(); ERR("Health error occurred in %s", __func__); } - health_unregister(); + health_unregister(health_sessiond); DBG("Application communication apps thread cleanup complete"); rcu_thread_offline(); rcu_unregister_thread(); @@ -1512,7 +1515,7 @@ static void *thread_dispatch_ust_registration(void *data) .count = 0, }; - health_register(HEALTH_TYPE_APP_REG_DISPATCH); + health_register(health_sessiond, HEALTH_TYPE_APP_REG_DISPATCH); health_code_update(); @@ -1723,7 +1726,7 @@ error: health_error(); ERR("Health error occurred in %s", __func__); } - health_unregister(); + health_unregister(health_sessiond); return NULL; } @@ -1743,7 +1746,7 @@ static void *thread_registration_apps(void *data) DBG("[thread] Manage application registration started"); - health_register(HEALTH_TYPE_APP_REG); + health_register(health_sessiond, HEALTH_TYPE_APP_REG); if (testpoint(thread_registration_apps)) { goto error_testpoint; @@ -1923,7 +1926,7 @@ error_listen: error_create_poll: error_testpoint: DBG("UST Registration thread cleanup complete"); - health_unregister(); + health_unregister(health_sessiond); return NULL; } @@ -2300,7 +2303,7 @@ static int check_consumer_health(void) { int ret; - ret = health_check_state(HEALTH_TYPE_CONSUMER); + ret = health_check_state(health_sessiond, HEALTH_TYPE_CONSUMER); DBG3("Health consumer check %d", ret); @@ -3564,39 +3567,39 @@ restart: switch (msg.component) { case LTTNG_HEALTH_CMD: - reply.ret_code = health_check_state(HEALTH_TYPE_CMD); + reply.ret_code = health_check_state(health_sessiond, HEALTH_TYPE_CMD); break; case LTTNG_HEALTH_APP_MANAGE: - reply.ret_code = health_check_state(HEALTH_TYPE_APP_MANAGE); + reply.ret_code = health_check_state(health_sessiond, HEALTH_TYPE_APP_MANAGE); break; case LTTNG_HEALTH_APP_REG: - reply.ret_code = health_check_state(HEALTH_TYPE_APP_REG); + reply.ret_code = health_check_state(health_sessiond, HEALTH_TYPE_APP_REG); break; case LTTNG_HEALTH_KERNEL: - reply.ret_code = health_check_state(HEALTH_TYPE_KERNEL); + reply.ret_code = health_check_state(health_sessiond, HEALTH_TYPE_KERNEL); break; case LTTNG_HEALTH_CONSUMER: reply.ret_code = check_consumer_health(); break; case LTTNG_HEALTH_HT_CLEANUP: - reply.ret_code = health_check_state(HEALTH_TYPE_HT_CLEANUP); + reply.ret_code = health_check_state(health_sessiond, HEALTH_TYPE_HT_CLEANUP); break; case LTTNG_HEALTH_APP_MANAGE_NOTIFY: - reply.ret_code = health_check_state(HEALTH_TYPE_APP_MANAGE_NOTIFY); + reply.ret_code = health_check_state(health_sessiond, HEALTH_TYPE_APP_MANAGE_NOTIFY); break; case LTTNG_HEALTH_APP_REG_DISPATCH: - reply.ret_code = health_check_state(HEALTH_TYPE_APP_REG_DISPATCH); + reply.ret_code = health_check_state(health_sessiond, HEALTH_TYPE_APP_REG_DISPATCH); break; case LTTNG_HEALTH_ALL: reply.ret_code = - health_check_state(HEALTH_TYPE_APP_MANAGE) && - health_check_state(HEALTH_TYPE_APP_REG) && - health_check_state(HEALTH_TYPE_CMD) && - health_check_state(HEALTH_TYPE_KERNEL) && + health_check_state(health_sessiond, HEALTH_TYPE_APP_MANAGE) && + health_check_state(health_sessiond, HEALTH_TYPE_APP_REG) && + health_check_state(health_sessiond, HEALTH_TYPE_CMD) && + health_check_state(health_sessiond, HEALTH_TYPE_KERNEL) && check_consumer_health() && - health_check_state(HEALTH_TYPE_HT_CLEANUP) && - health_check_state(HEALTH_TYPE_APP_MANAGE_NOTIFY) && - health_check_state(HEALTH_TYPE_APP_REG_DISPATCH); + health_check_state(health_sessiond, HEALTH_TYPE_HT_CLEANUP) && + health_check_state(health_sessiond, HEALTH_TYPE_APP_MANAGE_NOTIFY) && + health_check_state(health_sessiond, HEALTH_TYPE_APP_REG_DISPATCH); break; default: reply.ret_code = LTTNG_ERR_UND; @@ -3664,7 +3667,7 @@ static void *thread_manage_clients(void *data) rcu_register_thread(); - health_register(HEALTH_TYPE_CMD); + health_register(health_sessiond, HEALTH_TYPE_CMD); if (testpoint(thread_manage_clients)) { goto error_testpoint; @@ -3888,7 +3891,7 @@ error_testpoint: ERR("Health error occurred in %s", __func__); } - health_unregister(); + health_unregister(health_sessiond); DBG("Client thread dying"); @@ -4719,7 +4722,12 @@ int main(int argc, char **argv) * Initialize the health check subsystem. This call should set the * appropriate time values. */ - health_init(); + health_sessiond = health_app_create(HEALTH_NUM_TYPE); + if (!health_sessiond) { + PERROR("health_app_create error"); + goto exit_health_sessiond_cleanup; + } + health_init(health_sessiond); /* Create thread to manage the client socket */ ret = pthread_create(&ht_cleanup_thread, NULL, @@ -4862,6 +4870,8 @@ exit_health: goto error; /* join error, exit without cleanup */ } exit_ht_cleanup: + health_app_destroy(health_sessiond); +exit_health_sessiond_cleanup: exit: /* * cleanup() is called when no other thread is running. diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 916cd8828..5464880fc 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -34,7 +34,7 @@ #include "buffer-registry.h" #include "fd-limit.h" -#include "health.h" +#include "health-sessiond.h" #include "ust-app.h" #include "ust-consumer.h" #include "ust-ctl.h" diff --git a/src/bin/lttng-sessiond/ust-consumer.c b/src/bin/lttng-sessiond/ust-consumer.c index 308798eb1..ee56d6dea 100644 --- a/src/bin/lttng-sessiond/ust-consumer.c +++ b/src/bin/lttng-sessiond/ust-consumer.c @@ -28,7 +28,7 @@ #include #include "consumer.h" -#include "health.h" +#include "health-sessiond.h" #include "ust-consumer.h" #include "buffer-registry.h" #include "session.h" diff --git a/src/bin/lttng-sessiond/ust-thread.c b/src/bin/lttng-sessiond/ust-thread.c index 67c2971d6..683718326 100644 --- a/src/bin/lttng-sessiond/ust-thread.c +++ b/src/bin/lttng-sessiond/ust-thread.c @@ -23,7 +23,7 @@ #include "fd-limit.h" #include "lttng-sessiond.h" #include "ust-thread.h" -#include "health.h" +#include "health-sessiond.h" /* * This thread manage application notify communication. @@ -39,7 +39,7 @@ void *ust_thread_manage_notify(void *data) rcu_register_thread(); rcu_thread_online(); - health_register(HEALTH_TYPE_APP_MANAGE_NOTIFY); + health_register(health_sessiond, HEALTH_TYPE_APP_MANAGE_NOTIFY); health_code_update(); @@ -176,7 +176,7 @@ error_poll_create: health_error(); ERR("Health error occurred in %s", __func__); } - health_unregister(); + health_unregister(health_sessiond); rcu_thread_offline(); rcu_unregister_thread(); return NULL; diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 83bb8d351..871be3859 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -30,11 +30,13 @@ test_uri_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBHASHTABLE) SESSIONS=$(top_builddir)/src/bin/lttng-sessiond/session.o \ $(top_builddir)/src/bin/lttng-sessiond/consumer.o \ $(top_builddir)/src/bin/lttng-sessiond/utils.o \ - $(top_builddir)/src/bin/lttng-sessiond/health.o \ $(top_builddir)/src/bin/lttng-sessiond/snapshot.o \ $(top_builddir)/src/common/.libs/uri.o \ $(top_builddir)/src/common/.libs/utils.o \ - $(top_builddir)/src/common/.libs/error.o + $(top_builddir)/src/common/.libs/error.o \ + $(top_builddir)/src/common/health/libhealth.la \ + $(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la + test_session_SOURCES = test_session.c test_session_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM) \ @@ -52,11 +54,12 @@ UST_DATA_TRACE=$(top_builddir)/src/bin/lttng-sessiond/trace-ust.o \ $(top_builddir)/src/bin/lttng-sessiond/ust-app.o \ $(top_builddir)/src/bin/lttng-sessiond/ust-consumer.o \ $(top_builddir)/src/bin/lttng-sessiond/fd-limit.o \ - $(top_builddir)/src/bin/lttng-sessiond/health.o \ $(top_builddir)/src/bin/lttng-sessiond/session.o \ $(top_builddir)/src/bin/lttng-sessiond/snapshot.o \ $(top_builddir)/src/common/.libs/uri.o \ - $(top_builddir)/src/common/.libs/utils.o + $(top_builddir)/src/common/.libs/utils.o \ + $(top_builddir)/src/common/health/libhealth.la \ + $(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la test_ust_data_SOURCES = test_ust_data.c test_ust_data_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM)\ @@ -67,10 +70,11 @@ endif # Kernel data structures unit test KERN_DATA_TRACE=$(top_builddir)/src/bin/lttng-sessiond/trace-kernel.o \ $(top_builddir)/src/bin/lttng-sessiond/consumer.o \ - $(top_builddir)/src/bin/lttng-sessiond/health.o \ $(top_builddir)/src/bin/lttng-sessiond/utils.o \ $(top_builddir)/src/common/.libs/uri.o \ - $(top_builddir)/src/common/.libs/utils.o + $(top_builddir)/src/common/.libs/utils.o \ + $(top_builddir)/src/common/health/libhealth.la \ + $(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la test_kernel_data_SOURCES = test_kernel_data.c test_kernel_data_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM) \ -- 2.34.1