babeltrace.git
6 years agoFix: unchecked return values of bt_value getters
Mathieu Desnoyers [Thu, 3 Aug 2017 13:59:20 +0000 (09:59 -0400)] 
Fix: unchecked return values of bt_value getters

CID 1376153 (#1 of 1): Unchecked return value (CHECKED_RETURN).
check_return: Calling bt_value_bool_get without checking return value
(as is done elsewhere 18 out of 20 times).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: unchecked return value of stream flush
Jérémie Galarneau [Thu, 3 Aug 2017 13:49:22 +0000 (09:49 -0400)] 
Fix: unchecked return value of stream flush

Coverity:

CID 1376154 (#1 of 1): Unchecked return value (CHECKED_RETURN)1.
check_return: Calling bt_ctf_stream_flush without checking return value
(as is done elsewhere 5 out of 6 times).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: unchecked return value
Mathieu Desnoyers [Thu, 3 Aug 2017 13:43:29 +0000 (09:43 -0400)] 
Fix: unchecked return value

Found by Coverity:

CID 1376155 (#1 of 1): Unchecked return value (CHECKED_RETURN).
check_return: Calling bt_value_string_get without checking return value
(as is done elsewhere 44 out of 47 times).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: remove dead code
Mathieu Desnoyers [Thu, 3 Aug 2017 13:35:12 +0000 (09:35 -0400)] 
Fix: remove dead code

Found by Coverity:

notnull: At condition event, the value of event cannot be NULL.
   dead_error_condition: The condition event must be true.
CID 1376157 (#1 of 1): Logically dead code (DEADCODE)dead_error_line:
Execution cannot reach the expression NULL inside this statement:
event_class = (event ? bt_g...

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: wrong variable checked for NULL after allocation
Jérémie Galarneau [Wed, 9 Aug 2017 19:46:47 +0000 (15:46 -0400)] 
Fix: wrong variable checked for NULL after allocation

Found by Coverity:

writer_component->base_path = g_string_new(path);
notnull: At condition writer_component, the value of writer_component
cannot be NULL.
dead_error_condition: The condition !writer_component cannot be true.

CID 1376158 (#1 of 1): Logically dead code (DEADCODE)dead_error_begin:
Execution cannot reach this statement: ret = BT_COMPONENT_STATUS_E..

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCleanup: dereference after null check
Jérémie Galarneau [Wed, 9 Aug 2017 19:42:03 +0000 (15:42 -0400)] 
Cleanup: dereference after null check

Found by Coverity:

CID 1376165 (#1 of 1): Dereference after null check (FORWARD_NULL)3.
var_deref_op: Dereferencing null pointer v.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: add missing goto end on error
Mathieu Desnoyers [Wed, 26 Jul 2017 18:09:52 +0000 (14:09 -0400)] 
Fix: add missing goto end on error

Found by Coverity:

CID 1376168 (#1 of 1): Dereference after null check (FORWARD_NULL)7.
var_deref_model: Passing null pointer
debug_info_component->arg_debug_info_field_name to sprintf, which
dereferences it.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCleanup: remove logically dead code
Mathieu Desnoyers [Wed, 26 Jul 2017 18:08:02 +0000 (14:08 -0400)] 
Cleanup: remove logically dead code

Found by Coverity:

dead_error_condition: The condition ret ==
BT_NOTIFICATION_ITERATOR_STATUS_OK cannot be true.
206        if (ret == BT_NOTIFICATION_ITERATOR_STATUS_OK) {
   CID 1376170 (#1 of 1): Logically dead code (DEADCODE)dead_error_line:
Execution cannot reach this statement: ret = BT_NOTIFICATION_ITERA....

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: dereference after null check
Mathieu Desnoyers [Wed, 26 Jul 2017 18:06:13 +0000 (14:06 -0400)] 
Fix: dereference after null check

Found by Coverity:

CID 1376171 (#1 of 1): Dereference after null check (FORWARD_NULL)6.
var_deref_op: Dereferencing null pointer stream.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: wrong variable in NULL check
Mathieu Desnoyers [Wed, 26 Jul 2017 17:23:47 +0000 (13:23 -0400)] 
Fix: wrong variable in NULL check

Found by Coverity:

notnull: At condition impl_args, the value of impl_args cannot be NULL.
dead_error_condition: The condition !impl_args cannot be true.

CID 1376172 (#1 of 1): Logically dead code (DEADCODE)dead_error_begin:
Execution cannot reach this statement: print_err_oom();.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCleanup: remove logically dead code
Mathieu Desnoyers [Wed, 26 Jul 2017 17:21:43 +0000 (13:21 -0400)] 
Cleanup: remove logically dead code

Found by Coverity:

null: At condition fp, the value of fp must be NULL.
dead_error_condition: The condition fp cannot be true.

CID 1376173 (#1 of 1): Logically dead code (DEADCODE)dead_error_begin:
Execution cannot reach this statement: fclose(fp);

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCleanup: identical code for different branches
Mathieu Desnoyers [Wed, 26 Jul 2017 17:18:01 +0000 (13:18 -0400)] 
Cleanup: identical code for different branches

Found by Coverity:

CID 1376174 (#1 of 1): Identical code for different branches
(IDENTICAL_BRANCHES)identical_branches: The same code is executed when
the condition !trimmer is true or false, because the code in the if-then
branch and after the if statement is identical. Should the if statement
be removed?

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: add missing bound checking in decode_packet
Mathieu Desnoyers [Wed, 26 Jul 2017 17:14:39 +0000 (13:14 -0400)] 
Fix: add missing bound checking in decode_packet

Found by Coverity:

overflow_assign: Assigning overflowed or truncated value (or a value
computed from an overflowed or a truncated value) to toread.

overflow: Subtract operation overflows on operands toread and
readlen. Example values for operands: toread = 268435457, readlen =
9223372037074107386.

overflow_assign: Assigning overflowed or truncated value (or a value
computed from an overflowed or a truncated value) to readlen.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: Dereference null return value
Mathieu Desnoyers [Wed, 26 Jul 2017 16:06:53 +0000 (12:06 -0400)] 
Fix: Dereference null return value

Found by Coverity:

2. returned_null: bt_ctf_field_type_variant_get_tag_name returns null
(checked 4 out of 5 times).

3. var_assigned: Assigning: pathstr = null return value from
bt_ctf_field_type_variant_get_tag_name.

CID 1376176 (#1 of 1): Dereference null return value (NULL_RETURNS).
dereference: Dereferencing a pointer that might be null pathstr when
calling pathstr_to_field_path.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: null check after deref, use uninitialized or freed variable
Mathieu Desnoyers [Wed, 26 Jul 2017 16:02:56 +0000 (12:02 -0400)] 
Fix: null check after deref, use uninitialized or freed variable

Found by Coverity:

CID 1376179 (#1 of 1): Dereference before null check
(REVERSE_INULL)check_after_deref: Null-checking stream_state suggests
that it may be null, but it has already been dereferenced on all paths
leading to the check.

Reorganized this function so we clear the stream_state (set to NULL)
whenever we return success or error, so the caller don't end up using
uninitialized variable.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCleanup: missing empty line between functions
Jérémie Galarneau [Tue, 8 Aug 2017 21:35:29 +0000 (17:35 -0400)] 
Cleanup: missing empty line between functions

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoUse logging macros in src.ctf-fs queries
Jérémie Galarneau [Tue, 8 Aug 2017 21:31:51 +0000 (17:31 -0400)] 
Use logging macros in src.ctf-fs queries

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: missing ftell/fseek error handling
Mathieu Desnoyers [Wed, 26 Jul 2017 15:55:11 +0000 (11:55 -0400)] 
Fix: missing ftell/fseek error handling

Found by Coverity:

CID 1376181 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS).
negative_returns: filesize is passed to a parameter that cannot be
negative.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: use of file pointer after fclose()
Mathieu Desnoyers [Wed, 26 Jul 2017 15:50:52 +0000 (11:50 -0400)] 
Fix: use of file pointer after fclose()

See fclose(3). Further access to out_fp after both success and error,
even through another bt_close_memstream(), results in undefined
behavior. Nullify out_fp to ensure we don't fclose it twice on error.

Found by Coverity:

CID 1376182 (#1 of 1): Use after close (USE_AFTER_FREE).
use_closed_file: Calling bt_close_memstream uses file handle out_fp
after closing it.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCleanup: mixing enum types
Mathieu Desnoyers [Wed, 26 Jul 2017 15:40:01 +0000 (11:40 -0400)] 
Cleanup: mixing enum types

Found by Coverity:

CID 1376185 (#3 of 3): Inferred misuse of enum (MIXED_ENUMS)mixed_enums:
Mixing enum types enum bt_value_status and enum bt_graph_status for ret.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: missing check of ftell error
Mathieu Desnoyers [Mon, 24 Jul 2017 22:04:53 +0000 (18:04 -0400)] 
Fix: missing check of ftell error

Found by Coverity:

CID 1376186 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
13. negative_returns: init_pos is passed to a parameter that cannot be
negative.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: mixed enums used in source.ctf.fs
Mathieu Desnoyers [Mon, 24 Jul 2017 22:01:56 +0000 (18:01 -0400)] 
Fix: mixed enums used in source.ctf.fs

Found by Coverity:

CID 1376187 (#3 of 3): Inferred misuse of enum (MIXED_ENUMS)
mixed_enums: Mixing enum types enum bt_component_status and enum
bt_value_status for ret.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: Dereference null return value
Jérémie Galarneau [Mon, 24 Jul 2017 21:26:57 +0000 (17:26 -0400)] 
Fix: Dereference null return value

Found by Coverity:

3. returned_null: bt_ctf_field_string_get_value returns null (checked 10
out of 12 times).

CID 1376192 (#1 of 1): Dereference null return value (NULL_RETURNS)
4. dereference: Dereferencing a pointer that might be null
bt_ctf_field_string_get_value(field) when calling print_escape_string.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: assert compared unsigned to 0
Mathieu Desnoyers [Mon, 24 Jul 2017 21:21:17 +0000 (17:21 -0400)] 
Fix: assert compared unsigned to 0

Found by Coverity:

CID 1376195 (#1 of 1): Macro compares unsigned to 0 (NO_EFFECT)
unsigned_compare: This greater-than-or-equal-to-zero comparison of an
unsigned value is always true. event_class_id >= 0UL.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: negative loop bound check
Mathieu Desnoyers [Mon, 24 Jul 2017 21:15:53 +0000 (17:15 -0400)] 
Fix: negative loop bound check

Found by Coverity:

CID 1376197 (#1 of 1): Negative loop bound (NEGATIVE_RETURNS)
3. negative_returns: Using unsigned variable
bt_value_array_size(run_args) in a loop exit condition.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: resolve.c: enum type mismatch
Mathieu Desnoyers [Mon, 24 Jul 2017 21:12:35 +0000 (17:12 -0400)] 
Fix: resolve.c: enum type mismatch

Found by Coverity:

CID 1376200 (#2 of 2): Inferred misuse of enum (MIXED_ENUMS)
mixed_enums: Mixing enum types enum bt_ctf_field_type_id and enum
ctf_type_id for ctx_cur_field_type_id.

(audited whole file for similar pattern)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: Explicit null dereferenced
Mathieu Desnoyers [Mon, 24 Jul 2017 21:00:08 +0000 (17:00 -0400)] 
Fix: Explicit null dereferenced

Found by Coverity:

CID 1376244 (#3 of 3): Explicit null dereferenced (FORWARD_NULL)
10. var_deref_op: Dereferencing null pointer node.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoStandard logging for ctf.fs sink
Julien Desfossez [Fri, 28 Jul 2017 19:55:11 +0000 (15:55 -0400)] 
Standard logging for ctf.fs sink

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoStandard logging for libctfcopytrace
Julien Desfossez [Fri, 28 Jul 2017 14:01:43 +0000 (10:01 -0400)] 
Standard logging for libctfcopytrace

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoStandard logging for debug_info plugin
Julien Desfossez [Thu, 27 Jul 2017 19:20:21 +0000 (15:20 -0400)] 
Standard logging for debug_info plugin

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoStandard logging for trimmer/copy.c
Julien Desfossez [Thu, 27 Jul 2017 16:07:17 +0000 (12:07 -0400)] 
Standard logging for trimmer/copy.c

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix tests: run plugins test wrapper script
Michael Jeanson [Thu, 20 Jul 2017 18:53:38 +0000 (14:53 -0400)] 
Fix tests: run plugins test wrapper script

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix test: intersection has too large offset_s
Michael Jeanson [Thu, 20 Jul 2017 16:48:47 +0000 (12:48 -0400)] 
Fix test: intersection has too large offset_s

The offset_s values multiplied by 1000000000 overflows 64-bit.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTests: only run debug info tests when the feature is enabled
Michael Jeanson [Wed, 19 Jul 2017 20:14:59 +0000 (16:14 -0400)] 
Tests: only run debug info tests when the feature is enabled

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: Add dummy symbol for macOS linker
Michael Jeanson [Thu, 13 Jul 2017 15:26:53 +0000 (11:26 -0400)] 
Port: Add dummy symbol for macOS linker

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoUpdate gitignore
Michael Jeanson [Tue, 11 Jul 2017 15:26:13 +0000 (11:26 -0400)] 
Update gitignore

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: use a separate variable for elfutils libs
Michael Jeanson [Mon, 17 Jul 2017 22:21:56 +0000 (18:21 -0400)] 
Port: use a separate variable for elfutils libs

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: built-in plugins support for the macOS linker
Michael Jeanson [Mon, 17 Jul 2017 21:31:22 +0000 (17:31 -0400)] 
Port: built-in plugins support for the macOS linker

The macOS linker requires different options to force link all the
objects in a static archive, detect this at configure.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: 'struct tm' member count vary across platforms
Michael Jeanson [Thu, 13 Jul 2017 19:11:10 +0000 (15:11 -0400)] 
Port: 'struct tm' member count vary across platforms

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: Solaris and Cygwin have no sys/syslimits.h
Michael Jeanson [Thu, 13 Jul 2017 19:08:29 +0000 (15:08 -0400)] 
Port: Solaris and Cygwin have no sys/syslimits.h

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: cast result of be64toh() to uint64_t for print format
Michael Jeanson [Tue, 11 Jul 2017 18:48:40 +0000 (14:48 -0400)] 
Port: cast result of be64toh() to uint64_t for print format

The type of the return value of be64toh() can vary from unsigned long to
unsigned long long across platforms, cast it to the longer type before
printing.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: __STRINGIFY exists on Cygwin
Michael Jeanson [Tue, 11 Jul 2017 17:38:52 +0000 (13:38 -0400)] 
Port: __STRINGIFY exists on Cygwin

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: Add Solaris tid support to logging
Michael Jeanson [Tue, 11 Jul 2017 16:40:56 +0000 (12:40 -0400)] 
Port: Add Solaris tid support to logging

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: Add Cygwin tid support to logging
Michael Jeanson [Tue, 11 Jul 2017 19:58:32 +0000 (15:58 -0400)] 
Port: Add Cygwin tid support to logging

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: unlink() requires unistd.h on Solaris and macOS
Michael Jeanson [Mon, 10 Jul 2017 16:41:19 +0000 (12:41 -0400)] 
Port: unlink() requires unistd.h on Solaris and macOS

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: handle 'size_t' / 'off_t' on Solaris
Michael Jeanson [Mon, 10 Jul 2017 16:39:38 +0000 (12:39 -0400)] 
Port: handle 'size_t' / 'off_t' on Solaris

The size of 'size_t' / 'off_t' vary on some platforms, use C99 portable
macros and print formats to handle them.

Print 'size_t' with '%zu' and use SIZE_MAX as max value.
Print 'off_t' casted to 'intmax_t' with '%jd'.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: replace strerror_r() by g_strerror()
Michael Jeanson [Fri, 7 Jul 2017 20:58:48 +0000 (20:58 +0000)] 
Port: replace strerror_r() by g_strerror()

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: replace opendir() by g_dir_open()
Michael Jeanson [Fri, 7 Jul 2017 20:08:23 +0000 (20:08 +0000)] 
Port: replace opendir() by g_dir_open()

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: replace setenv() by g_setenv()
Michael Jeanson [Tue, 13 Jun 2017 20:10:17 +0000 (20:10 +0000)] 
Port: replace setenv() by g_setenv()

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: append to LIBS, don't override it
Michael Jeanson [Tue, 18 Jul 2017 15:08:44 +0000 (11:08 -0400)] 
Fix: append to LIBS, don't override it

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: do not include malloc.h
Michael Jeanson [Wed, 12 Jul 2017 19:15:14 +0000 (15:15 -0400)] 
Port: do not include malloc.h

malloc.h does not exists on all platforms and is included by stdlib.h

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: visit_event_decl(): always set stream_id variable
Philippe Proulx [Tue, 18 Jul 2017 23:44:43 +0000 (19:44 -0400)] 
Fix: visit_event_decl(): always set stream_id variable

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: don't store an int64_t value in a ptr
Michael Jeanson [Wed, 12 Jul 2017 20:23:11 +0000 (16:23 -0400)] 
Fix: don't store an int64_t value in a ptr

The key of the stream_classes GHashTable was a int64_t stored directly
in a pointer which works only on 64bits platform. Instead, allocate a
int64_t value and use a pointer to it as the key.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: use extern for variables instead of BT_HIDDEN
Michael Jeanson [Wed, 12 Jul 2017 19:14:54 +0000 (15:14 -0400)] 
Fix: use extern for variables instead of BT_HIDDEN

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: logging in socket-internal.h
Michael Jeanson [Fri, 7 Jul 2017 20:59:13 +0000 (20:59 +0000)] 
Fix: logging in socket-internal.h

Log statements in static inline functions must be ifdefed.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: remove g_ptr_array_insert to keep glib 2.22 compat
Michael Jeanson [Fri, 14 Jul 2017 18:50:31 +0000 (14:50 -0400)] 
Fix: remove g_ptr_array_insert to keep glib 2.22 compat

closes #1120

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: g_hash_table_insert returns 'void' in glib <= 2.39.2
Michael Jeanson [Mon, 10 Jul 2017 16:36:50 +0000 (12:36 -0400)] 
Fix: g_hash_table_insert returns 'void' in glib <= 2.39.2

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: G_SPAWN_DEFAULT was introduced in glib 2.37.6
Michael Jeanson [Mon, 10 Jul 2017 15:55:20 +0000 (11:55 -0400)] 
Fix: G_SPAWN_DEFAULT was introduced in glib 2.37.6

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPretty plugin: only print negative timestamp warning once per component
Mathieu Desnoyers [Mon, 17 Jul 2017 19:30:29 +0000 (15:30 -0400)] 
Pretty plugin: only print negative timestamp warning once per component

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix test: packet seq num has too large offset_s
Mathieu Desnoyers [Mon, 17 Jul 2017 19:26:07 +0000 (15:26 -0400)] 
Fix test: packet seq num has too large offset_s

The offset_s values multiplied by 1000000000 overflows 64-bit.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoctf: visitor-generate-ir: accept negative clock offsets
Philippe Proulx [Thu, 13 Jul 2017 21:16:09 +0000 (17:16 -0400)] 
ctf: visitor-generate-ir: accept negative clock offsets

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: clock-class.c: cache ns from Epoch and check for overflows
Philippe Proulx [Thu, 13 Jul 2017 20:35:33 +0000 (16:35 -0400)] 
Fix: clock-class.c: cache ns from Epoch and check for overflows

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: ctf: notif-iter: error on empty events (0 bits of data)
Philippe Proulx [Thu, 13 Jul 2017 16:18:29 +0000 (12:18 -0400)] 
Fix: ctf: notif-iter: error on empty events (0 bits of data)

Do not create an event which consumed 0 bits of data stream: log an
error and return without creating it. We keep the buffer position at the
beginning of the last decoded event header, and we compare to the
current buffer position: if they are the same, then we consumed 0 bits
of data. It is possible, when we compare, that notit->buf.last_eh_at is
-1ULL (reset when requesting bytes from medium): in this case, we know
we requested bytes anyway, which means we consumed something to get to
this starvation point, thus the event is not empty.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: test: expect the new warning format for seqnum
Mathieu Desnoyers [Wed, 12 Jul 2017 20:55:21 +0000 (16:55 -0400)] 
Fix: test: expect the new warning format for seqnum

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: packet sequence number handling and discarded packet reporting
Mathieu Desnoyers [Wed, 12 Jul 2017 20:47:34 +0000 (16:47 -0400)] 
Fix: packet sequence number handling and discarded packet reporting

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoctf: notif-iter.c: check state on BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF
Philippe Proulx [Wed, 12 Jul 2017 00:12:37 +0000 (20:12 -0400)] 
ctf: notif-iter.c: check state on BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF

When the notif iter's request_bytes() medium operation returns
BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF, make sure that the notif iter
instance is in an expected state. Which states are valid depend on the
metadata (is there a packet size or not, etc.). Return an error from
request_medium_bytes() when the state is incorrect.

This solves streams which should fail but pass, for example when the
data ends within the middle of a packet header field, a packet context
field, or an event.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agocli: do not allow --stream-intersection with --run-args/--run-args-0
Philippe Proulx [Wed, 12 Jul 2017 19:29:49 +0000 (15:29 -0400)] 
cli: do not allow --stream-intersection with --run-args/--run-args-0

Also test this in test_convert_args.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix test_convert_args
Philippe Proulx [Wed, 12 Jul 2017 19:24:20 +0000 (15:24 -0400)] 
Fix test_convert_args

* Clock class offset parameters are given with --params so that the
  CLI interprets their values as integers.
* --stream-intersection does not work with --run-args or --run-args-0.
* Duplicate --verbose is not checked anymore

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agocli: fix implicit clock class offset parameters
Philippe Proulx [Wed, 12 Jul 2017 19:23:59 +0000 (15:23 -0400)] 
cli: fix implicit clock class offset parameters

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCompletely rework configure.ac
Michael Jeanson [Thu, 6 Jul 2017 22:53:09 +0000 (18:53 -0400)] 
Completely rework configure.ac

Full re-organisation of the configure.ac to regroup instructions by
task, automake initialixation, autoconf initialization, OS specific
default values, compiler checks, header checks, linker checks, user
variables, configure switches and so on.

Also BUILT_IN_PLUGINS was moved to --enable-built-in-plugins and
BUILT_IN_PYTHON_PLUGIN_SUPPORT to --enable-built-in-python-plugin-support
as those make more sense as toggles and most users are familiar with
this syntax.

Plus a lot of minor fixes and cleanups.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoUpdate autoconf archive macros
Michael Jeanson [Wed, 5 Jul 2017 21:03:49 +0000 (17:03 -0400)] 
Update autoconf archive macros

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoClean LICENSE file
Michael Jeanson [Wed, 5 Jul 2017 20:42:13 +0000 (16:42 -0400)] 
Clean LICENSE file

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCleanup: bison and flex detection
Michael Jeanson [Thu, 29 Jun 2017 19:59:07 +0000 (15:59 -0400)] 
Cleanup: bison and flex detection

The previous detection code was quite convoluted and required to have
two variables set to the same value to work. For example, the lexer in
autotools is configured through the LEX variable, even if we require a
specific implementation we have to use it and base our detection code on
it.

The situation is now :

  - the FLEX and BISON variables are ignored.
  - the LEX and YACC variables need to be set if required like before.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCleanup: uuid library detection
Michael Jeanson [Thu, 29 Jun 2017 19:41:58 +0000 (15:41 -0400)] 
Cleanup: uuid library detection

Simplify libuuid detection code and use a variable to store the detected
lib instead of adding conditionnal code to each Makefile.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCleanup: popt library detection
Michael Jeanson [Thu, 29 Jun 2017 19:26:12 +0000 (15:26 -0400)] 
Cleanup: popt library detection

Simplify popt detection code and use a variable to store the detected
lib instead of using the global LIBS variable.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: Don't override user variables within the build system
Michael Jeanson [Thu, 29 Jun 2017 18:26:16 +0000 (14:26 -0400)] 
Fix: Don't override user variables within the build system

Instead use the appropriatly prefixed AM_* variables as to not interfere
when a user variable is passed to a make command. The proper use of flag
variables is documented at :

https://www.gnu.org/software/automake/manual/automake.html#Flag-Variables-Ordering

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: built-in plugins with new plugin filenames
Michael Jeanson [Mon, 10 Jul 2017 19:22:39 +0000 (15:22 -0400)] 
Fix: built-in plugins with new plugin filenames

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agotest_plugin: use env. var. instead of global symbol because G_MODULE_BIND_LOCAL
Philippe Proulx [Fri, 7 Jul 2017 21:13:14 +0000 (17:13 -0400)] 
test_plugin: use env. var. instead of global symbol because G_MODULE_BIND_LOCAL

Share data between test plugins and the plugin test with environment
variables instead of using global symbols because shared objects are
opened with G_MODULE_BIND_LOCAL now.

Also add BT_PLUGIN_MODULE() to test plugins so that their special
sections exist and contain entries.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest fix: fixed allocation size used for variable length input
Jérémie Galarneau [Fri, 7 Jul 2017 20:13:32 +0000 (16:13 -0400)] 
Test fix: fixed allocation size used for variable length input

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agobabeltrace-log: pass single-trace=yes to sink.ctf.fs
Philippe Proulx [Fri, 7 Jul 2017 19:17:05 +0000 (15:17 -0400)] 
babeltrace-log: pass single-trace=yes to sink.ctf.fs

Babeltrace 1's babeltrace-log(1) used to output the trace directly into
the specified directory, not in a subdirectory which is the trace name
(always `STDIN` in this case). Pass single-trace=yes to the sink.ctf.fs
instance to replicate this elaborate strategy.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: dead code in lttng_live_iterator_next_no_stream()
Jérémie Galarneau [Fri, 7 Jul 2017 19:46:30 +0000 (15:46 -0400)] 
Fix: dead code in lttng_live_iterator_next_no_stream()

CID 1376159 (#1 of 1): Logically dead code (DEADCODE)
dead_error_begin: Execution cannot reach this statement:
case BT_CTF_LTTNG_LIVE_ITER...

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: uninitialized return value member
Jérémie Galarneau [Fri, 7 Jul 2017 19:45:54 +0000 (15:45 -0400)] 
Fix: uninitialized return value member

CID 1376198 (#1 of 1): Uninitialized scalar variable (UNINIT)
uninit_use: Using uninitialized value next_return.
Field next_return.notification is uninitialized.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: ds_file_group is checked instead of ds_file_group->stream
Jérémie Galarneau [Fri, 7 Jul 2017 18:58:31 +0000 (14:58 -0400)] 
Fix: ds_file_group is checked instead of ds_file_group->stream

** CID 1377287:  Null pointer dereferences  (REVERSE_INULL)
/plugins/ctf/fs-src/fs.c: 902 in create_ds_file_groups()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix babeltrace-log(1) for Babeltrace 2
Philippe Proulx [Fri, 7 Jul 2017 01:55:48 +0000 (21:55 -0400)] 
Fix babeltrace-log(1) for Babeltrace 2

This fixes babeltrace-log(1) so that it works with the Babeltrace 2
tree.

What the program does now is to parse its arguments, create the
arguments to be passed to the babeltrace(1) CLI tool, and spawn a
babeltrace(1) process to build and run a processing graph.

babeltrace-log(1) executes babeltrace(1) as such:

    babeltrace run --component dmesg:src.text.dmesg --params read-from-stdin=yes
                   --params no-extract-timestamp=yes --component ctf:sink.ctf.fs
                   --key path --value /output/path --connect dmesg:ctf

`no-extract-timestamp=yes` becomes `no-extract-timestamp=no` with
babeltrace-log(1)'s -t/--with-timestamps option. The standard input is
forwarded to the child process.

Like babeltrace(1), the build system creates both babeltrace-log and
babeltrace-log.bin executables. The former spawns the in-tree
babeltrace(1) tool while the latter spawns the installed version.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agosrc.text.dmesg: add `no-extract-timestamp` option
Philippe Proulx [Thu, 6 Jul 2017 06:17:22 +0000 (02:17 -0400)] 
src.text.dmesg: add `no-extract-timestamp` option

Babeltrace 1's babeltrace-log(1) has a -t option to extract timestamps
and write them to the event headers. It makes more sense to extract them
by default in the component itself, but babeltrace-log(1) can pass
no-extract-timestamp=yes when -t is not provided.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agolib/ctf-ir/clock-class.c: serialize `true`/`false` instead of `TRUE`/`FALSE`
Philippe Proulx [Wed, 5 Jul 2017 23:13:39 +0000 (19:13 -0400)] 
lib/ctf-ir/clock-class.c: serialize `true`/`false` instead of `TRUE`/`FALSE`

The `signed` attribute of an integer field type is serialized in
lowercase.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agolib/ctf-ir/clock-class.c: only serialize UUID if it is set
Philippe Proulx [Wed, 5 Jul 2017 23:12:57 +0000 (19:12 -0400)] 
lib/ctf-ir/clock-class.c: only serialize UUID if it is set

Otherwise we get:

    uuid = "00000000-0000-0000-0000-000000000000";

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd src.text.dmesg component class
Philippe Proulx [Wed, 5 Jul 2017 23:00:58 +0000 (19:00 -0400)] 
Add src.text.dmesg component class

The new src.text.dmesg component class reads the standard input or a
specific file and converts each line to a CTF IR event, building the
appropriate metadata objects when needed.

This component does what babeltrace-log(1) used to do. The
babeltrace-log(1) application can be replicated as such:

    dmesg | babeltrace -c src.text.dmesg -p read-from-stdin=yes \
                       --no-debug-info -o ctf -w /path/to/output

The component class's initialization parameters are:

`read-from-stdin`:
    True to read the lines from the standard input stream (excludes
    `path`).

`path`:
    Path to the regular file from which to read lines (excludes
    `read-from-stdin`).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoplugins/ctf/plugin.c: fix comment
Philippe Proulx [Wed, 5 Jul 2017 18:38:05 +0000 (14:38 -0400)] 
plugins/ctf/plugin.c: fix comment

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoctf: notif-iter: pass current stream ID to get_stream() medop
Philippe Proulx [Wed, 5 Jul 2017 16:14:47 +0000 (12:14 -0400)] 
ctf: notif-iter: pass current stream ID to get_stream() medop

Make the notif iter's get_stream() medop receive the current stream
(instance) ID as a parameter, if any, so that the callee can create a
stream with bt_ctf_stream_create_with_id(), if this is needed, with the
appropriate stream ID which is only known dynamically after decoding the
first packet header.

In the case of src.ctf.fs, the streams are already created with the
appropriate stream IDs because the component deals with data stream file
groups and must mark the trace as static at creation time, so the new
parameter is ignored. In the case of src.ctf.lttng-live, we cannot read
the first packet header and then rewind (or it is rather complicated to
do so), so the stream object is created the first time get_stream() is
called with the received ID.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agosrc.ctf.fs: fs.c: add missing `static`
Philippe Proulx [Wed, 5 Jul 2017 16:14:24 +0000 (12:14 -0400)] 
src.ctf.fs: fs.c: add missing `static`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoctf: notif-iter: ensure that all packets refer to the same stream class
Philippe Proulx [Wed, 5 Jul 2017 16:03:40 +0000 (12:03 -0400)] 
ctf: notif-iter: ensure that all packets refer to the same stream class

Disallow, within the same packet sequence (decoded by a single CTF notif
iter instance), two packets to be described by two different stream
classes, which would also mean two different streams. Log a specific
warning message when this happens, e.g.:

    07-05 12:05:04.235 17923 17923 W PLUGIN-CTF-NOTIF-ITER
    set_current_stream_class@notif-iter.c:961 Two packets refer to two
    different stream classes within the same packet sequence:
    notit-addr=0xd97b20, prev-stream-class-addr=0xdc0b20,
    prev-stream-class-name="(null)", prev-stream-class-id=33,
    next-stream-class-addr=0xdc13d0, next-stream-class-name="(null)",
    next-stream-class-id=34, trace-addr=0xda3650, trace-name="ctf2"

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: remove clock value leak in sink.text.pretty
Philippe Proulx [Wed, 5 Jul 2017 16:03:33 +0000 (12:03 -0400)] 
Fix: remove clock value leak in sink.text.pretty

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agosink.text.pretty: append `s` only if plural in discarded elems. msg.
Philippe Proulx [Tue, 4 Jul 2017 20:25:53 +0000 (16:25 -0400)] 
sink.text.pretty: append `s` only if plural in discarded elems. msg.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agolib: use dedicated BT_LOG*_ERRNO() instead of using strerror()
Philippe Proulx [Tue, 4 Jul 2017 20:15:04 +0000 (16:15 -0400)] 
lib: use dedicated BT_LOG*_ERRNO() instead of using strerror()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agotest_ctf_writer.c: use environment variable to override packet resize length
Philippe Proulx [Tue, 4 Jul 2017 20:02:57 +0000 (16:02 -0400)] 
test_ctf_writer.c: use environment variable to override packet resize length

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agosink.ctf.fs: use original stream's name as CTF writer stream's name
Philippe Proulx [Tue, 4 Jul 2017 20:02:27 +0000 (16:02 -0400)] 
sink.ctf.fs: use original stream's name as CTF writer stream's name

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoir: stream: prefer to use stream's name for (CTF writer) stream's path
Philippe Proulx [Tue, 4 Jul 2017 20:00:12 +0000 (16:00 -0400)] 
ir: stream: prefer to use stream's name for (CTF writer) stream's path

When creating a stream file for a given CTF writer stream object, use
this format:

    PREFIX-SCID-SID

PREFIX:
    1. Base name of stream's name, if it exists.
    2. Base name of stream class's name, if it exists.
    3. `stream`

SCID:
    Stream class's ID.

SID:
    Stream's ID.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agosink.text.pretty: print discarded events and packets messages
Philippe Proulx [Tue, 4 Jul 2017 17:59:54 +0000 (13:59 -0400)] 
sink.text.pretty: print discarded events and packets messages

When getting a discarded events or discarded packets notification in
sink.text.pretty, print a warning on the standard error stream (to
remain compatible with Babeltrace 1 which does that) which looks like
this:

    WARNING: Tracer discarded 83565 events between [20:01:32.062781965]
    and [20:01:32.126649071] in trace "hostname/the-trace" (UUID:
    a560bbc4-7f93-b346-a980-3959745a0f5d) within stream
    "/home/user/my-traces/the-trace/stream-1048576_3_0"
    (stream class ID: 1, stream ID: 3).

The message also indicates when the trace has no UUID, or when the
stream has no (instance) ID. The stream class ID is always available.
When the trace's or stream's name is unavailable, `(unknown)` is
printed.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agosrc.ctf.fs: name the stream objects with their file's path
Philippe Proulx [Tue, 4 Jul 2017 17:53:16 +0000 (13:53 -0400)] 
src.ctf.fs: name the stream objects with their file's path

This patch makes a src.ctf.fs component name its stream objects. The
name of a stream object is the full path of the first file of its
backing data stream file group.

The purpose of those names is for sink.text.pretty to indicate in which
file (or which file group) events or packets were discarded by the
tracer.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.042756 seconds and 4 git commands to generate.