if (ret < 0) {
fprintf(stderr, "[warning] [Context] cannot open trace \"%s\" "
"for reading.\n", path);
- /* Allow to skip erroneous traces. */
- ret = 1; /* partial error */
}
return ret;
}
return -1;
}
-void lttng_live_read(struct lttng_live_ctx *ctx)
+int lttng_live_read(struct lttng_live_ctx *ctx)
{
- int ret, i;
+ int ret = -1;
+ int i;
struct bt_ctf_iter *iter;
const struct bt_ctf_event *event;
struct bt_iter_pos begin_pos;
int flags;
if (lttng_live_should_quit()) {
+ ret = 0;
goto end_free;
}
while (!ctx->session->stream_count) {
if (lttng_live_should_quit()
|| ctx->session_ids->len == 0) {
+ ret = 0;
goto end_free;
}
ret = ask_new_streams(ctx);
}
for (;;) {
if (lttng_live_should_quit()) {
+ ret = 0;
goto end_free;
}
event = bt_ctf_iter_read_event_flags(iter, &flags);
end_free:
bt_context_put(ctx->bt_ctx);
end:
- return;
+ return ret;
}
}
if (ctx->session_ids->len > 0) {
- lttng_live_read(ctx);
+ ret = lttng_live_read(ctx);
}
end_free:
pos->parent.rw_table = NULL;
pos->parent.event_cb = NULL;
pos->parent.trace = &pos->trace_descriptor;
- lttng_live_open_trace_read(path);
+ if (lttng_live_open_trace_read(path) < 0) {
+ goto error;
+ }
return &pos->trace_descriptor;
error:
int lttng_live_establish_connection(struct lttng_live_ctx *ctx);
int lttng_live_list_sessions(struct lttng_live_ctx *ctx, const char *path);
int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id);
-void lttng_live_read(struct lttng_live_ctx *ctx);
+int lttng_live_read(struct lttng_live_ctx *ctx);
int lttng_live_get_new_streams(struct lttng_live_ctx *ctx, uint64_t id);
int lttng_live_should_quit(void);