ir: stream: add bt_ctf_stream_is_writer()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 13 Jan 2017 20:24:27 +0000 (15:24 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 18:09:08 +0000 (14:09 -0400)
This function indicates whether or not the stream is in
"CTF writer mode", that is, its trace parent was created by a
CTF writer object and it has an open file descriptor.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/stream.c
include/babeltrace/ctf-writer/stream.h

index d4dbc447ca6a6b1fe16d6004c90e408c97f1ee61..5e9e133794232aeba637540998dd6afd7c84c4bd 100644 (file)
@@ -1000,3 +1000,17 @@ const char *bt_ctf_stream_get_name(struct bt_ctf_stream *stream)
 end:
        return name;
 }
+
+int bt_ctf_stream_is_writer(struct bt_ctf_stream *stream)
+{
+       int ret = -1;
+
+       if (!stream) {
+               goto end;
+       }
+
+       ret = (stream->pos.fd >= 0);
+
+end:
+       return ret;
+}
index f8ad7b835b600e18755bee789af89066663cb9b9..56b6bff8c29edb10bd5e1da77050d4345d6c506f 100644 (file)
@@ -152,6 +152,8 @@ extern int bt_ctf_stream_set_packet_context(
  */
 extern int bt_ctf_stream_flush(struct bt_ctf_stream *stream);
 
+extern int bt_ctf_stream_is_writer(struct bt_ctf_stream *stream);
+
 /*
  * bt_ctf_stream_get and bt_ctf_stream_put: increment and decrement the
  * stream's reference count.
This page took 0.025828 seconds and 4 git commands to generate.