relayd: track the quit pipe with the fd-tracker
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 26 Nov 2019 22:08:52 +0000 (17:08 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 30 Jan 2020 06:55:34 +0000 (01:55 -0500)
Create the relayd quit pipe through the
fd_tracker_util_pipe_open_cloexec() function which wraps
utils_create_pipe_cloexec(), but tracks the resulting file descriptor.

The close of the pipe is also performed through the fd tracker.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia2a000030765e8df990e0ea3d35a8bf157630d9f

src/bin/lttng-relayd/main.c

index ed424d9dd0c9036768aeff6d29e4d2a146210308..6234e3e170d92515d1255a15087906531369083a 100644 (file)
@@ -64,6 +64,7 @@
 #include <common/buffer-view.h>
 #include <common/string-utils/format.h>
 #include <common/fd-tracker/fd-tracker.h>
+#include <common/fd-tracker/utils.h>
 
 #include "backward-compatibility-group-by.h"
 #include "cmd.h"
@@ -664,8 +665,10 @@ static void relayd_cleanup(void)
        }
        /* Close thread quit pipes */
        utils_close_pipe(health_quit_pipe);
-       utils_close_pipe(thread_quit_pipe);
-
+       if (thread_quit_pipe[0] != -1) {
+               (void) fd_tracker_util_pipe_close(
+                               the_fd_tracker, thread_quit_pipe);
+       }
        if (sessiond_trace_chunk_registry) {
                sessiond_trace_chunk_registry_destroy(
                                sessiond_trace_chunk_registry);
@@ -835,11 +838,8 @@ void lttng_relay_notify_ready(void)
  */
 static int init_thread_quit_pipe(void)
 {
-       int ret;
-
-       ret = utils_create_pipe_cloexec(thread_quit_pipe);
-
-       return ret;
+       return fd_tracker_util_pipe_open_cloexec(
+                       the_fd_tracker, "Quit pipe", thread_quit_pipe);
 }
 
 /*
This page took 0.03806 seconds and 5 git commands to generate.