#include <babeltrace/ctf-ir/stream-internal.h>
#include <babeltrace/ctf-ir/trace-internal.h>
#include <babeltrace/ref.h>
+#include <babeltrace/endian.h>
#include <babeltrace/compiler.h>
#include <stdio.h>
#include <stdlib.h>
struct bt_ctf_writer *bt_ctf_writer_create(const char *path)
{
+ int ret;
struct bt_ctf_writer *writer = NULL;
if (!path) {
writer->trace->is_created_by_writer = 1;
bt_object_set_parent(writer->trace, writer);
bt_put(writer->trace);
+
+ /* Default to little-endian */
+ ret = bt_ctf_writer_set_byte_order(writer, BT_CTF_BYTE_ORDER_NATIVE);
+ assert(ret == 0);
+
/* Create trace directory if necessary and open a metadata file */
if (g_mkdir_with_parents(path, S_IRWXU | S_IRWXG)) {
perror("g_mkdir_with_parents");
goto end;
}
+ if (byte_order == BT_CTF_BYTE_ORDER_NATIVE) {
+ byte_order = BT_CTF_MY_BYTE_ORDER;
+ }
+
ret = bt_ctf_trace_set_native_byte_order(writer->trace,
byte_order);
end: