* SOFTWARE.
*/
+#define BT_LOG_TAG "PLUGIN-CTF-LTTNG-LIVE-SRC-METADATA"
+#include "logging.h"
+
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <babeltrace/compat/memstream-internal.h>
#include <babeltrace/graph/graph.h>
-#define BT_LOG_TAG "PLUGIN-CTF-LTTNG-LIVE-METADATA"
-
#include "metadata.h"
#include "../common/metadata/decoder.h"
goto end;
}
+ if (!metadata->trace) {
+ trace->new_metadata_needed = false;
+ }
+
if (!trace->new_metadata_needed) {
goto end;
}
* the data streams are done.
*/
lttng_live_unref_trace(metadata->trace);
+ metadata->trace = NULL;
}
if (errno == EINTR) {
- if (bt_graph_is_canceled(session->lttng_live->graph)) {
+ if (lttng_live_is_canceled(session->lttng_live)) {
status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
goto end;
}
goto end;
}
- if (babeltrace_debug) {
- // yydebug = 1;
- }
-
fp = bt_fmemopen(metadata_buf, len_read, "rb");
if (!fp) {
BT_LOGE("Cannot memory-open metadata buffer: %s",
BT_LOGE("Error on fclose");
}
}
+ free(metadata_buf);
return status;
}
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) {
}
metadata->stream_id = stream_id;
//TODO: add clock offset option
- //TODO: add (preferably unique) trace's name
- metadata->decoder = ctf_metadata_decoder_create(stderr, 0,
- "lttng-live");
+ match = strstr(trace_name, session->session_name->str);
+ if (!match) {
+ goto error;
+ }
+ metadata->decoder = ctf_metadata_decoder_create(NULL,
+ match);
if (!metadata->decoder) {
goto error;
}
}
ctf_metadata_decoder_destroy(metadata->decoder);
trace->metadata = NULL;
- lttng_live_unref_trace(trace);
if (!metadata->closed) {
lttng_live_unref_trace(metadata->trace);
}