X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.cpp;h=cf7aa9e9e67bc94c971982133ef8ea49ed7fd128;hb=c9e313bc594f40a86eed237dce222c0fc99c957f;hp=58cf092eac444762ea9d96960f65dd53326fcffd;hpb=4971b7f0243bd3a7a661bcf1cfe95f0f8014b59b;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/main.cpp b/src/bin/lttng-sessiond/main.cpp index 58cf092ea..cf7aa9e9e 100644 --- a/src/bin/lttng-sessiond/main.cpp +++ b/src/bin/lttng-sessiond/main.cpp @@ -29,55 +29,53 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "lttng-sessiond.h" -#include "buffer-registry.h" -#include "channel.h" -#include "cmd.h" -#include "consumer.h" -#include "context.h" -#include "event.h" -#include "event-notifier-error-accounting.h" -#include "kernel.h" -#include "kernel-consumer.h" -#include "lttng-ust-ctl.h" -#include "ust-consumer.h" -#include "utils.h" -#include "fd-limit.h" -#include "health-sessiond.h" -#include "testpoint.h" -#include "notify-apps.h" -#include "agent-thread.h" -#include "save.h" -#include "notification-thread.h" -#include "notification-thread-commands.h" -#include "rotation-thread.h" -#include "agent.h" -#include "ht-cleanup.h" -#include "sessiond-config.h" -#include "timer.h" -#include "thread.h" -#include "client.h" -#include "dispatch.h" -#include "register.h" -#include "manage-apps.h" -#include "manage-kernel.h" -#include "modprobe.h" -#include "ust-sigbus.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "lttng-sessiond.hpp" +#include "buffer-registry.hpp" +#include "channel.hpp" +#include "cmd.hpp" +#include "consumer.hpp" +#include "context.hpp" +#include "event.hpp" +#include "event-notifier-error-accounting.hpp" +#include "kernel.hpp" +#include "kernel-consumer.hpp" +#include "lttng-ust-ctl.hpp" +#include "ust-consumer.hpp" +#include "utils.hpp" +#include "fd-limit.hpp" +#include "health-sessiond.hpp" +#include "testpoint.hpp" +#include "notify-apps.hpp" +#include "agent-thread.hpp" +#include "save.hpp" +#include "notification-thread.hpp" +#include "notification-thread-commands.hpp" +#include "rotation-thread.hpp" +#include "agent.hpp" +#include "sessiond-config.hpp" +#include "timer.hpp" +#include "thread.hpp" +#include "client.hpp" +#include "dispatch.hpp" +#include "register.hpp" +#include "manage-apps.hpp" +#include "manage-kernel.hpp" +#include "modprobe.hpp" +#include "ust-sigbus.hpp" static const char *help_msg = #ifdef LTTNG_EMBED_HELP @@ -796,7 +794,8 @@ end: * See config_entry_handler_cb comment in common/config/session-config.h for the * return value conventions. */ -static int config_entry_handler(const struct config_entry *entry, void *unused) +static int config_entry_handler(const struct config_entry *entry, + void *unused __attribute__((unused))) { int ret = 0, i; @@ -1173,7 +1172,8 @@ error: * Simply stop all worker threads, leaving main() return gracefully after * joining all threads and calling cleanup(). */ -static void sighandler(int sig, siginfo_t *siginfo, void *arg) +static void sighandler(int sig, siginfo_t *siginfo, + void *arg __attribute__((unused))) { switch (sig) { case SIGINT: @@ -1360,6 +1360,7 @@ static void unregister_all_triggers(void) unsigned int trigger_count, i; const struct lttng_credentials creds = { .uid = LTTNG_OPTIONAL_INIT_VALUE(0), + .gid = LTTNG_OPTIONAL_INIT_UNSET, }; DBG("Unregistering all triggers"); @@ -1448,7 +1449,6 @@ int main(int argc, char **argv) struct lttng_pipe *ust32_channel_monitor_pipe = NULL, *ust64_channel_monitor_pipe = NULL, *kernel_channel_monitor_pipe = NULL; - struct lttng_thread *ht_cleanup_thread = NULL; struct timer_thread_parameters timer_thread_parameters; /* Rotation thread handle. */ struct rotation_thread_handle *rotation_thread_handle = NULL; @@ -1497,9 +1497,7 @@ int main(int argc, char **argv) * Parse arguments and load the daemon configuration file. * * We have an exit_options exit path to free memory reserved by - * set_options. This is needed because the rest of sessiond_cleanup() - * depends on ht_cleanup_thread, which depends on lttng_daemonize, which - * depends on set_options. + * set_options. */ progname = argv[0]; if (set_options(argc, argv)) { @@ -1600,13 +1598,6 @@ int main(int argc, char **argv) goto stop_threads; } - /* Create thread to clean up RCU hash tables */ - ht_cleanup_thread = launch_ht_cleanup_thread(); - if (!ht_cleanup_thread) { - retval = -1; - goto stop_threads; - } - /* Create thread quit pipe */ if (sessiond_init_thread_quit_pipe()) { retval = -1; @@ -1961,10 +1952,7 @@ stop_threads: * perform lookups in those structures. */ rcu_barrier(); - /* - * sessiond_cleanup() is called when no other thread is running, except - * the ht_cleanup thread, which is needed to destroy the hash tables. - */ + rcu_thread_online(); sessiond_cleanup(); @@ -2001,18 +1989,6 @@ stop_threads: modprobe_remove_lttng_all(); } - /* - * Ensure all prior call_rcu are done. call_rcu callbacks may push - * hash tables to the ht_cleanup thread. Therefore, we ensure that - * the queue is empty before shutting down the clean-up thread. - */ - rcu_barrier(); - - if (ht_cleanup_thread) { - lttng_thread_shutdown(ht_cleanup_thread); - lttng_thread_put(ht_cleanup_thread); - } - rcu_thread_offline(); rcu_unregister_thread();