Tests: add a test for the "skip non-empy" rmdir flag
[lttng-tools.git] / src / bin / lttng-sessiond / trace-ust.c
index 45dbec74e174feac9a7aba9932666b87f18e5628..b1bae1794ab70560d7e4e74c4520793659de4ac9 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/trace-chunk.h>
 
 #include "buffer-registry.h"
 #include "trace-ust.h"
@@ -827,13 +828,14 @@ int trace_ust_pid_tracker_lookup(struct ltt_ust_session *session, int pid)
 int trace_ust_track_pid(struct ltt_ust_session *session, int pid)
 {
        int retval = LTTNG_OK;
+       bool should_update_apps = false;
 
        if (pid == -1) {
                /* Track all pids: destroy tracker if exists. */
                if (session->pid_tracker.ht) {
                        fini_pid_tracker(&session->pid_tracker);
                        /* Ensure all apps have session. */
-                       ust_app_global_update_all(session);
+                       should_update_apps = true;
                }
        } else {
                int ret;
@@ -852,7 +854,7 @@ int trace_ust_track_pid(struct ltt_ust_session *session, int pid)
                                goto end;
                        }
                        /* Remove all apps from session except pid. */
-                       ust_app_global_update_all(session);
+                       should_update_apps = true;
                } else {
                        struct ust_app *app;
 
@@ -864,10 +866,13 @@ int trace_ust_track_pid(struct ltt_ust_session *session, int pid)
                        /* Add session to application */
                        app = ust_app_find_by_pid(pid);
                        if (app) {
-                               ust_app_global_update(session, app);
+                               should_update_apps = true;
                        }
                }
        }
+       if (should_update_apps && session->active) {
+               ust_app_global_update_all(session);
+       }
 end:
        return retval;
 }
@@ -1195,6 +1200,6 @@ void trace_ust_destroy_session(struct ltt_ust_session *session)
        consumer_output_put(session->consumer);
 
        fini_pid_tracker(&session->pid_tracker);
-
+       lttng_trace_chunk_put(session->current_trace_chunk);
        free(session);
 }
This page took 0.024264 seconds and 4 git commands to generate.