The lttng-live plugin does not return an error code when trying
to open a live trace that is already opened by another client.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
if (ret < 0) {
fprintf(stderr, "[warning] [Context] cannot open trace \"%s\" "
"for reading.\n", path);
if (ret < 0) {
fprintf(stderr, "[warning] [Context] cannot open trace \"%s\" "
"for reading.\n", path);
- /* Allow to skip erroneous traces. */
- ret = 1; /* partial error */
-void lttng_live_read(struct lttng_live_ctx *ctx)
+int lttng_live_read(struct lttng_live_ctx *ctx)
struct bt_ctf_iter *iter;
const struct bt_ctf_event *event;
struct bt_iter_pos begin_pos;
struct bt_ctf_iter *iter;
const struct bt_ctf_event *event;
struct bt_iter_pos begin_pos;
int flags;
if (lttng_live_should_quit()) {
int flags;
if (lttng_live_should_quit()) {
goto end_free;
}
while (!ctx->session->stream_count) {
if (lttng_live_should_quit()
|| ctx->session_ids->len == 0) {
goto end_free;
}
while (!ctx->session->stream_count) {
if (lttng_live_should_quit()
|| ctx->session_ids->len == 0) {
goto end_free;
}
ret = ask_new_streams(ctx);
goto end_free;
}
ret = ask_new_streams(ctx);
}
for (;;) {
if (lttng_live_should_quit()) {
}
for (;;) {
if (lttng_live_should_quit()) {
goto end_free;
}
event = bt_ctf_iter_read_event_flags(iter, &flags);
goto end_free;
}
event = bt_ctf_iter_read_event_flags(iter, &flags);
end_free:
bt_context_put(ctx->bt_ctx);
end:
end_free:
bt_context_put(ctx->bt_ctx);
end:
}
if (ctx->session_ids->len > 0) {
}
if (ctx->session_ids->len > 0) {
+ ret = lttng_live_read(ctx);
pos->parent.rw_table = NULL;
pos->parent.event_cb = NULL;
pos->parent.trace = &pos->trace_descriptor;
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:
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);
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);
int lttng_live_get_new_streams(struct lttng_live_ctx *ctx, uint64_t id);
int lttng_live_should_quit(void);