Fix lttctl flight recorder wait for daemon (temp fix)
[ltt-control.git] / lttctl / lttctl.c
index e5631928053c4930b57f5ae35b9754a7070b5a85..e77b7f38d6833f8abc2cc8dd0fba8b19b9a9c146 100644 (file)
@@ -156,6 +156,11 @@ static void show_arguments(void)
        printf("        Set channels root path, For -w option."
                " (ex. /mnt/debugfs/ltt)\n");
        printf("\n");
+       printf(" Environment variables:\n");
+       printf("  LTT_DAEMON\n");
+       printf("       Complete path to the lttd binary (needs to be\n");
+       printf("       specified if different than package build prefix).\n");
+       printf("\n");
 }
 
 /*
@@ -691,10 +696,13 @@ setup_trace_fail:
 }
 
 /*
- * Start a lttd daemon to write trace datas
+ * Start a lttd daemon to write trace data
  * Dump overwrite channels on overwrite!=0
  * Dump normal(non-overwrite) channels on overwrite=0
  *
+ * When called for overwrite mode, wait for lttd to return, so we are sure that
+ * trace session teardown is not executed before lttd can grab the buffer data.
+ *
  * ret: 0 on success
  *      !0 on fail
  */
@@ -789,6 +797,16 @@ static int lttctl_daemon(int overwrite)
        if (WEXITSTATUS(status))
                fprintf(stderr, "lttd process running failed\n");
 
+       /*
+        * FIXME
+        * This is a temporary hack to ensure that the lttd daemon grabs
+        * handles on the debugfs buffer files before we destroy the trace
+        * session. Properly handling this will imply separating the "flush"
+        * from the "destroy" operation at kernel-level in LTTng.
+        */
+       if (overwrite)
+               sleep(2);
+
        return WEXITSTATUS(status);
 }
 
This page took 0.022179 seconds and 4 git commands to generate.