X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=cli%2Fbabeltrace.c;h=ad5f22f716208a619977552e7d4202508a3f51d7;hb=2e00bc76cf37af167c45253cfc8f8d197222d6b8;hp=a0de86f770139881ca8599f97a6312ff704b079a;hpb=f280892e9c882183c4af86992e41efc39a017802;p=babeltrace.git diff --git a/cli/babeltrace.c b/cli/babeltrace.c index a0de86f7..ad5f22f7 100644 --- a/cli/babeltrace.c +++ b/cli/babeltrace.c @@ -51,20 +51,22 @@ static const char* log_level_env_var_names[] = { "BABELTRACE_COMMON_LOG_LEVEL", "BABELTRACE_COMPAT_LOG_LEVEL", - "BABELTRACE_PLUGIN_CTF_BTR_LOG_LEVEL", - "BABELTRACE_SINK_CTF_FS_LOG_LEVEL", - "BABELTRACE_SRC_CTF_FS_LOG_LEVEL", - "BABELTRACE_SRC_CTF_LTTNG_LIVE_LOG_LEVEL", - "BABELTRACE_PLUGIN_CTF_METADATA_LOG_LEVEL", - "BABELTRACE_PLUGIN_CTF_MSG_ITER_LOG_LEVEL", - "BABELTRACE_PLUGIN_CTFCOPYTRACE_LIB_LOG_LEVEL", + "BABELTRACE_CTFSER_LOG_LEVEL", + "BABELTRACE_FD_CACHE_LOG_LEVEL", "BABELTRACE_FLT_LTTNG_UTILS_DEBUG_INFO_LOG_LEVEL", - "BABELTRACE_SRC_TEXT_DMESG_LOG_LEVEL", - "BABELTRACE_SINK_TEXT_PRETTY_LOG_LEVEL", + "BABELTRACE_FLT_UTILS_COUNTER_LOG_LEVEL", "BABELTRACE_FLT_UTILS_MUXER_LOG_LEVEL", "BABELTRACE_FLT_UTILS_TRIMMER_LOG_LEVEL", + "BABELTRACE_PLUGIN_CTF_BFCR_LOG_LEVEL", + "BABELTRACE_PLUGIN_CTF_METADATA_LOG_LEVEL", + "BABELTRACE_PLUGIN_CTF_MSG_ITER_LOG_LEVEL", + "BABELTRACE_PLUGIN_CTF_UTILS_LOG_LEVEL", "BABELTRACE_PYTHON_BT2_LOG_LEVEL", - "BABELTRACE_PYTHON_PLUGIN_PROVIDER_LOG_LEVEL", + "BABELTRACE_SINK_CTF_FS_LOG_LEVEL", + "BABELTRACE_SINK_TEXT_PRETTY_LOG_LEVEL", + "BABELTRACE_SRC_CTF_FS_LOG_LEVEL", + "BABELTRACE_SRC_CTF_LTTNG_LIVE_LOG_LEVEL", + "BABELTRACE_SRC_TEXT_DMESG_LOG_LEVEL", NULL, }; @@ -493,6 +495,7 @@ void print_value_rec(FILE *fp, const bt_value *value, size_t indent) { bt_bool bool_val; int64_t int_val; + uint64_t uint_val; double dbl_val; const char *str_val; int size; @@ -513,8 +516,14 @@ void print_value_rec(FILE *fp, const bt_value *value, size_t indent) bt_common_color_fg_cyan(), bool_val ? "yes" : "no", bt_common_color_reset()); break; - case BT_VALUE_TYPE_INTEGER: - int_val = bt_value_integer_get(value); + case BT_VALUE_TYPE_UNSIGNED_INTEGER: + uint_val = bt_value_unsigned_integer_get(value); + fprintf(fp, "%s%s%" PRIu64 "%s\n", bt_common_color_bold(), + bt_common_color_fg_red(), uint_val, + bt_common_color_reset()); + break; + case BT_VALUE_TYPE_SIGNED_INTEGER: + int_val = bt_value_signed_integer_get(value); fprintf(fp, "%s%s%" PRId64 "%s\n", bt_common_color_bold(), bt_common_color_fg_red(), int_val, bt_common_color_reset()); @@ -1313,21 +1322,21 @@ int cmd_print_lttng_live_sessions(struct bt_config *cfg) BT_LOGE_STR("Unexpected empty array \"timer-us\" entry."); goto error; } - timer_us = bt_value_integer_get(v); + timer_us = bt_value_signed_integer_get(v); fprintf(out_stream, " (timer = %" PRIu64 ", ", timer_us); v = bt_value_map_borrow_entry_value_const(map, "stream-count"); if (!v) { BT_LOGE_STR("Unexpected empty array \"stream-count\" entry."); goto error; } - streams = bt_value_integer_get(v); + streams = bt_value_signed_integer_get(v); fprintf(out_stream, "%" PRIu64 " stream(s), ", streams); v = bt_value_map_borrow_entry_value_const(map, "client-count"); if (!v) { BT_LOGE_STR("Unexpected empty array \"client-count\" entry."); goto error; } - clients = bt_value_integer_get(v); + clients = bt_value_signed_integer_get(v); fprintf(out_stream, "%" PRIu64 " client(s) connected)\n", clients); } @@ -1359,7 +1368,7 @@ end: } } - return 0; + return ret; } static @@ -1471,7 +1480,7 @@ end: } } - return 0; + return ret; } struct port_id { @@ -1709,7 +1718,6 @@ int cmd_run_ctx_connect_upstream_port_to_downstream_component( } downstream_port_count = port_count_fn(downstream_comp); - BT_ASSERT(downstream_port_count >= 0); for (i = 0; i < downstream_port_count; i++) { const bt_port_input *in_downstream_port = @@ -1990,11 +1998,13 @@ end: } static -void graph_output_port_added_listener(struct cmd_run_ctx *ctx, +bt_graph_listener_status +graph_output_port_added_listener(struct cmd_run_ctx *ctx, const bt_port_output *out_port) { const bt_component *comp; const bt_port *port = bt_port_output_as_port_const(out_port); + bt_graph_listener_status ret = BT_GRAPH_LISTENER_STATUS_OK; comp = bt_port_borrow_component_const(port); BT_LOGI("Port added to a graph's component: comp-addr=%p, " @@ -2019,27 +2029,28 @@ void graph_output_port_added_listener(struct cmd_run_ctx *ctx, if (cmd_run_ctx_connect_upstream_port(ctx, out_port)) { BT_LOGF_STR("Cannot connect upstream port."); fprintf(stderr, "Added port could not be connected: aborting\n"); - abort(); + ret = BT_GRAPH_LISTENER_STATUS_ERROR; + goto end; } end: - return; + return ret; } static -void graph_source_output_port_added_listener( +bt_graph_listener_status graph_source_output_port_added_listener( const bt_component_source *component, const bt_port_output *port, void *data) { - graph_output_port_added_listener(data, port); + return graph_output_port_added_listener(data, port); } static -void graph_filter_output_port_added_listener( +bt_graph_listener_status graph_filter_output_port_added_listener( const bt_component_filter *component, const bt_port_output *port, void *data) { - graph_output_port_added_listener(data, port); + return graph_output_port_added_listener(data, port); } static @@ -2229,8 +2240,8 @@ int set_stream_intersections(struct cmd_run_ctx *ctx, goto error; } - begin = bt_value_integer_get(intersection_begin); - end = bt_value_integer_get(intersection_end); + begin = bt_value_signed_integer_get(intersection_begin); + end = bt_value_signed_integer_get(intersection_end); if (begin < 0 || end < 0 || end < begin) { BT_LOGW("Invalid trace stream intersection values: " @@ -2537,7 +2548,6 @@ int cmd_run_ctx_connect_comp_ports(struct cmd_run_ctx *ctx, uint64_t i; count = port_count_fn(comp); - BT_ASSERT(count >= 0); for (i = 0; i < count; i++) { const bt_port_output *upstream_port = port_by_index_fn(comp, i); @@ -2607,8 +2617,6 @@ const char *bt_graph_status_str(bt_graph_status status) return "BT_GRAPH_STATUS_CANCELED"; case BT_GRAPH_STATUS_ERROR: return "BT_GRAPH_STATUS_ERROR"; - case BT_GRAPH_STATUS_NO_SINK: - return "BT_GRAPH_STATUS_NO_SINK"; case BT_GRAPH_STATUS_NOMEM: return "BT_GRAPH_STATUS_NOMEM"; default: