X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=ltt-sessiond%2Fmain.c;h=66ea028dc4a0e5b30c5c86f81506485cb4a30f82;hp=abd4e087fd313c11fea10376393b32e9f6c29e5c;hb=3817e7df7aa29d8f52f1a4909b4fa6b660494323;hpb=72079caee725ad8d3ec0dc52fe7f982d61721b84 diff --git a/ltt-sessiond/main.c b/ltt-sessiond/main.c index abd4e087f..66ea028dc 100644 --- a/ltt-sessiond/main.c +++ b/ltt-sessiond/main.c @@ -29,29 +29,22 @@ #include #include #include -#include #include -#include +#include #include #include #include -#include -#include #include -#include /* URCU list library (-lurcu) */ -#include -#include +#include #include +#include +#include -#include "context.h" -#include "ltt-sessiond.h" -#include "lttngerr.h" #include "kernel-ctl.h" -#include "ust-ctl.h" -#include "session.h" +#include "ltt-sessiond.h" #include "traceable-app.h" -#include "ltt-kconsumerd.h" +#include "ust-ctl.h" #include "utils.h" /* Const values */ @@ -859,10 +852,10 @@ static void *thread_manage_apps(void *data) } /* - * Basic recv here to handle the very simple data - * that the libust send to register (reg_msg). + * Using message-based transmissions to ensure we don't + * have to deal with partially received messages. */ - ret = recv(sock, ®_msg, sizeof(reg_msg), 0); + ret = lttcomm_recv_unix_sock(sock, ®_msg, sizeof(reg_msg)); if (ret < 0) { perror("recv"); continue; @@ -871,6 +864,11 @@ static void *thread_manage_apps(void *data) /* Add application to the global traceable list */ if (reg_msg.reg == 1) { /* Registering */ + /* + * TODO: socket should be either passed to a + * listener thread (for more messages) or + * closed. It currently leaks. + */ ret = register_traceable_app(reg_msg.pid, reg_msg.uid); if (ret < 0) { /* register_traceable_app only return an error with