lttng-live: print discarded event and packet lost warnings on stderr
[babeltrace.git] / formats / ctf / ctf.c
index c960ef7291d49ee635d15165e51a2134b9069152..36424de5626a97a00ea4ff445da926fbcd91eb04 100644 (file)
@@ -36,7 +36,7 @@
 #include <babeltrace/context-internal.h>
 #include <babeltrace/compat/uuid.h>
 #include <babeltrace/endian.h>
-#include <babeltrace/trace-debuginfo.h>
+#include <babeltrace/trace-debug-info.h>
 #include <babeltrace/ctf/ctf-index.h>
 #include <inttypes.h>
 #include <stdio.h>
@@ -157,6 +157,14 @@ struct bt_format ctf_format = {
        .convert_index_timestamp = ctf_convert_index_timestamp,
 };
 
+void bt_ctf_hook(void)
+{
+       /*
+        * Dummy function to prevent the linker from discarding this format as
+        * "unused" in static builds.
+        */
+}
+
 static
 uint64_t ctf_timestamp_begin(struct bt_trace_descriptor *descriptor,
                struct bt_trace_handle *handle, enum bt_clock_type type)
@@ -426,7 +434,6 @@ void print_uuid(FILE *fp, unsigned char *uuid)
  * consumer had time to extract them. We keep track of those gaps with the
  * packet sequence number in each packet.
  */
-static
 void ctf_print_discarded_lost(FILE *fp, struct ctf_stream_definition *stream)
 {
        if ((!stream->events_discarded && !stream->packets_lost) ||
@@ -779,8 +786,6 @@ int ctf_init_pos(struct ctf_stream_pos *pos, struct bt_trace_descriptor *trace,
                pos->parent.rw_table = write_dispatch_table;
                pos->parent.event_cb = ctf_write_event;
                pos->parent.trace = trace;
-               if (fd >= 0)
-                       ctf_packet_seek(&pos->parent, 0, SEEK_SET);     /* position for write */
                break;
        default:
                assert(0);
@@ -2431,8 +2436,10 @@ struct bt_trace_descriptor *ctf_open_trace(const char *path, int flags,
 
        return &td->parent;
 error:
-       trace_debug_info_destroy(td);
-       g_free(td);
+       if (td) {
+               trace_debug_info_destroy(td);
+               g_free(td);
+       }
        return NULL;
 }
 
This page took 0.023247 seconds and 4 git commands to generate.