X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fdispatch.cpp;h=a8e8d6c8d44d48f3b712ceac08129fc86d0ac316;hb=1524f98c04431d04e50796f83a9dd29184b3a8a4;hp=b4092eb44793bc454641b1cf12ba5e60567bc419;hpb=7966af5763c4aaca39df9bbfa9277ff15715c720;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/dispatch.cpp b/src/bin/lttng-sessiond/dispatch.cpp index b4092eb44..a8e8d6c8d 100644 --- a/src/bin/lttng-sessiond/dispatch.cpp +++ b/src/bin/lttng-sessiond/dispatch.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 David Goulet + * Copyright (C) 2011 EfficiOS Inc. * Copyright (C) 2011 Mathieu Desnoyers * Copyright (C) 2013 Jérémie Galarneau * @@ -10,23 +10,25 @@ #include #include #include -#include -#include - -#include "dispatch.h" -#include "ust-app.h" -#include "testpoint.h" -#include "fd-limit.h" -#include "health-sessiond.h" -#include "lttng-sessiond.h" -#include "thread.h" - +#include +#include + +#include "dispatch.hpp" +#include "ust-app.hpp" +#include "testpoint.hpp" +#include "fd-limit.hpp" +#include "health-sessiond.hpp" +#include "lttng-sessiond.hpp" +#include "thread.hpp" + +namespace { struct thread_notifiers { struct ust_cmd_queue *ust_cmd_queue; int apps_cmd_pipe_write_fd; int apps_cmd_notify_pipe_write_fd; int dispatch_thread_exit; }; +} /* namespace */ /* * For each tracing session, update newly registered apps. The session list @@ -111,8 +113,7 @@ static void sanitize_wait_queue(struct ust_reg_wait_queue *wait_queue) cds_list_for_each_entry_safe(wait_node, tmp_wait_node, &wait_queue->head, head) { LTTNG_ASSERT(wait_node->app); - ret = lttng_poll_add(&events, wait_node->app->sock, - LPOLLHUP | LPOLLERR); + ret = lttng_poll_add(&events, wait_node->app->sock, LPOLLIN); if (ret < 0) { goto error; } @@ -231,6 +232,7 @@ static void *thread_dispatch_ust_registration(void *data) struct ust_reg_wait_node *wait_node = NULL, *tmp_wait_node; struct ust_reg_wait_queue wait_queue = { .count = 0, + .head = {}, }; struct thread_notifiers *notifiers = (thread_notifiers *) data; @@ -281,7 +283,7 @@ static void *thread_dispatch_ust_registration(void *data) break; } - ust_cmd = caa_container_of(node, struct ust_command, node); + ust_cmd = lttng::utils::container_of(node, &ust_command::node); DBG("Dispatching UST registration pid:%d ppid:%d uid:%d" " gid:%d sock:%d name:%s (version %d.%d)", @@ -291,7 +293,7 @@ static void *thread_dispatch_ust_registration(void *data) ust_cmd->reg_msg.major, ust_cmd->reg_msg.minor); if (ust_cmd->reg_msg.type == LTTNG_UST_CTL_SOCKET_CMD) { - wait_node = (ust_reg_wait_node *) zmalloc(sizeof(*wait_node)); + wait_node = zmalloc(); if (!wait_node) { PERROR("zmalloc wait_node dispatch"); ret = close(ust_cmd->sock); @@ -473,7 +475,7 @@ error: if (node == NULL) { break; } - ust_cmd = caa_container_of(node, struct ust_command, node); + ust_cmd = lttng::utils::container_of(node, &ust_command::node); ret = close(ust_cmd->sock); if (ret < 0) { PERROR("close ust sock exit dispatch %d", ust_cmd->sock); @@ -509,7 +511,7 @@ bool launch_ust_dispatch_thread(struct ust_cmd_queue *cmd_queue, struct lttng_thread *thread; struct thread_notifiers *notifiers; - notifiers = (thread_notifiers *) zmalloc(sizeof(*notifiers)); + notifiers = zmalloc(); if (!notifiers) { goto error; }