Fix: off by one in lttng-live path length check

Does not account for final \0.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: untrusted value as argument

Fix coverity:

CID 1132646 (#1 of 1): Untrusted value as argument (TAINTED_SCALAR)8.
tainted_data: Passing tainted variable "index_hdr.packet_index_len" to a
tainted sink.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cleanup: remove logically dead code

CID 1021557 (#1 of 1): Logically dead code (DEADCODE)
dead_error_line:
Execution cannot reach this statement "goto end;".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: missing little endian conversion for one index field

Locked-step with lttng-tools commit :
Fix: missing big endian conversion for one index field

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: lttng-live recv() and send() flags, partial recv()

Introduce lttng_live_recv() and lttng_live_send():

- Enforce MSG_NOSIGNAL flag for send(),
- Continue recv() after partial message is received.
- Handle EINTR within those wrappers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: lttng-live await metadata

Expect at least _some_ metadata in get_new_metadata. Retry until we
receive some metadata.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: lttng-live: 100ms active poll delay

Do a 100ms delay before retry intead of 1s delays (slightly too long in
terms of user experience) and instead of actively hogging the CPU (too
fast).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: accept empty metadata on append

"Append" should accept receiving metadata packets that contain exactly 0
byte of metadata payload. This kind of flush can happen on trace
teardown.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: handle new streams in get_data_packet()

- don't skip ask_new_streams() if new metadata _and_
  new streams are available.
- goto retry after getting new streams.
- Add missing "ret = 0" assignment at the end of the function. Takes
  care of "possible use of uninitialized variables" warnings in the
  caller given by gcc.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cleanup lttng-live: 80 columns wrapping

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cleanup lttng-live: add brackets in lttng_live_read()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cleanup: add brackets to lttng-live-plugin.c

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: Reverse incorrect error message argument order

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: add missing SIGTERM and SIGINT handler

Handle expected signals gracefully: stop processing at cancellation
points expected by the protocol, so the relay daemon does not print
error messages when clients quit gracefully.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: Don't assert on metadata generation failure

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Uninitialized scalar variable

Defect Reported-by: Coverity Scan

** CID 1187497:  Uninitialized scalar variable  (UNINIT)
/formats/lttng-live/lttng-live-comm.c: 753 in get_data_packet()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Remove negative comparison to unsigned value

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Move offset endianness conversion to get_data_packet

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: events discarded timing inaccuracy

Introduce babeltrace_ctf_console_output too, to ensure we only print
discarded events when a text output is used.

Fixes #589

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Version 1.2.0-rc2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>