X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbin%2Flttng-sessiond%2Fmanage-apps.cpp;h=27fa6ce85e0e47afd522698c7ebe067f8250ff17;hb=HEAD;hp=ea46f05277ca9aad79297afda111a2d1be461181;hpb=1524f98c04431d04e50796f83a9dd29184b3a8a4;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/manage-apps.cpp b/src/bin/lttng-sessiond/manage-apps.cpp index ea46f0527..ef55b452e 100644 --- a/src/bin/lttng-sessiond/manage-apps.cpp +++ b/src/bin/lttng-sessiond/manage-apps.cpp @@ -7,11 +7,13 @@ * */ +#include "health-sessiond.hpp" #include "manage-apps.hpp" #include "testpoint.hpp" -#include "health-sessiond.hpp" -#include "utils.hpp" #include "thread.hpp" +#include "utils.hpp" + +#include namespace { struct thread_notifiers { @@ -35,7 +37,7 @@ static void cleanup_application_management_thread(void *data) * * At that point, it flushes the data (tracing and metadata) associated * with this application and tears down ust app sessions and other - * associated data structures through ust_app_unregister(). + * associated data structures through ust_app_unregister_by_socket(). * * Note that this thread never sends commands to the applications * through the command sockets; it merely listens for hang-ups @@ -48,8 +50,7 @@ static void *thread_application_management(void *data) uint32_t nb_fd; struct lttng_poll_event events; struct thread_notifiers *notifiers = (thread_notifiers *) data; - const auto thread_quit_pipe_fd = lttng_pipe_get_readfd( - notifiers->quit_pipe); + const auto thread_quit_pipe_fd = lttng_pipe_get_readfd(notifiers->quit_pipe); DBG("[thread] Manage application started"); @@ -69,8 +70,7 @@ static void *thread_application_management(void *data) goto error_poll_create; } - ret = lttng_poll_add(&events, notifiers->apps_cmd_pipe_read_fd, - LPOLLIN | LPOLLRDHUP); + ret = lttng_poll_add(&events, notifiers->apps_cmd_pipe_read_fd, LPOLLIN | LPOLLRDHUP); if (ret < 0) { goto error; } @@ -86,15 +86,14 @@ static void *thread_application_management(void *data) health_code_update(); - while (1) { + while (true) { DBG("Apps thread polling"); /* Inifinite blocking call, waiting for transmission */ restart: health_poll_entry(); ret = lttng_poll_wait(&events, -1); - DBG("Apps thread return from poll on %d fds", - LTTNG_POLL_GETNB(&events)); + DBG("Apps thread return from poll on %d fds", LTTNG_POLL_GETNB(&events)); health_poll_exit(); if (ret < 0) { /* @@ -128,9 +127,9 @@ static void *thread_application_management(void *data) int sock; /* Empty pipe */ - size_ret = lttng_read( - notifiers->apps_cmd_pipe_read_fd, - &sock, sizeof(sock)); + size_ret = lttng_read(notifiers->apps_cmd_pipe_read_fd, + &sock, + sizeof(sock)); if (size_ret < sizeof(sock)) { PERROR("read apps cmd pipe"); goto error; @@ -168,9 +167,11 @@ static void *thread_application_management(void *data) } /* Socket closed on remote end. */ - ust_app_unregister(pollfd); + ust_app_unregister_by_socket(pollfd); } else { - ERR("Unexpected poll events %u for sock %d", revents, pollfd); + ERR("Unexpected poll events %u for sock %d", + revents, + pollfd); goto error; } } @@ -199,7 +200,7 @@ error_testpoint: DBG("Application communication apps thread cleanup complete"); rcu_thread_offline(); rcu_unregister_thread(); - return NULL; + return nullptr; } static bool shutdown_application_management_thread(void *data) @@ -213,7 +214,7 @@ static bool shutdown_application_management_thread(void *data) bool launch_application_management_thread(int apps_cmd_pipe_read_fd) { struct lttng_pipe *quit_pipe; - struct thread_notifiers *notifiers = NULL; + struct thread_notifiers *notifiers = nullptr; struct lttng_thread *thread; notifiers = zmalloc(); @@ -228,10 +229,10 @@ bool launch_application_management_thread(int apps_cmd_pipe_read_fd) notifiers->apps_cmd_pipe_read_fd = apps_cmd_pipe_read_fd; thread = lttng_thread_create("UST application management", - thread_application_management, - shutdown_application_management_thread, - cleanup_application_management_thread, - notifiers); + thread_application_management, + shutdown_application_management_thread, + cleanup_application_management_thread, + notifiers); if (!thread) { goto error; }