lttng-live: populate trace name
[babeltrace.git] / plugins / ctf / lttng-live / metadata.c
index 3124ff6c584d3dee2aaad5ed8b91ed9e4dcfe639..fcdb247e6eb2d4374e076adf25f385846b34acbf 100644 (file)
@@ -23,6 +23,9 @@
  * SOFTWARE.
  */
 
+#define BT_LOG_TAG "PLUGIN-CTF-LTTNG-LIVE-SRC-METADATA"
+#include "logging.h"
+
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -30,8 +33,7 @@
 #include <glib.h>
 #include <babeltrace/compat/uuid-internal.h>
 #include <babeltrace/compat/memstream-internal.h>
-
-#define BT_LOG_TAG "PLUGIN-CTF-LTTNG-LIVE-METADATA"
+#include <babeltrace/graph/graph.h>
 
 #include "metadata.h"
 #include "../common/metadata/decoder.h"
@@ -155,6 +157,12 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_metadata_update(
                         */
                        lttng_live_unref_trace(metadata->trace);
                }
+               if (errno == EINTR) {
+                       if (bt_graph_is_canceled(session->lttng_live->graph)) {
+                               status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
+                               goto end;
+                       }
+               }
        }
 
        if (bt_close_memstream(&metadata_buf, &size, fp)) {
@@ -221,10 +229,12 @@ end:
 BT_HIDDEN
 int lttng_live_metadata_create_stream(struct lttng_live_session *session,
                uint64_t ctf_trace_id,
-               uint64_t stream_id)
+               uint64_t stream_id,
+               const char *trace_name)
 {
        struct lttng_live_metadata *metadata = NULL;
        struct lttng_live_trace *trace;
+       const char *match;
 
        metadata = g_new0(struct lttng_live_metadata, 1);
        if (!metadata) {
@@ -232,7 +242,12 @@ int lttng_live_metadata_create_stream(struct lttng_live_session *session,
        }
        metadata->stream_id = stream_id;
        //TODO: add clock offset option
-       metadata->decoder = ctf_metadata_decoder_create(stderr, 0);
+       match = strstr(trace_name, session->session_name->str);
+       if (!match) {
+               goto error;
+       }
+       metadata->decoder = ctf_metadata_decoder_create(stderr, 0,
+               match);
        if (!metadata->decoder) {
                goto error;
        }
This page took 0.025718 seconds and 4 git commands to generate.