Fix: don't fail on push metadata if no channel

The comments in the code explains it well but in a nutshell, this is an
acceptable race between the creation of the metadata on the consumer
side and the push metadata from the session daemon for that channel.

This race is resolved by either having the consumer requesting metadata
or the session is stopped which will in both situation push the metadata
to the consumer.

Without that fix, the session daemon flags the registry's metadata to be
"closed" which usually indicates that the consumer is not responding
leading to the consumer thread exiting in the session daemon.

Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: update back the metadata len sent on failure

Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: missing lock/unlock when sending index

This was creating out of order messages between the relayd and the
consumer leading to undesired behaviour for the tracing session being
streamed.

Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: remove assert on fd in the read/write layer

It is possible that an invalid fd is passed to read or write. This can
happen for instance if the endpoint of the transport (ex: relayd) dies
out while actively trying to send data. It is OK to let an invalid fd
where the syscall will return the right value along with errno being
populated with the corresponding code.

Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Tests: fix bad argument parsing in test app

Signed-off-by: David Goulet <dgoulet@efficios.com>
Tests: fix racy tests and misleading output messages

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: backported from urcu commit 92af1a30

commit 92af1a30ca6a70945b167c31631c8598a626c71a
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date:   Thu Nov 28 18:41:13 2013 +0100

    Fix undefined NULL pointer arithmetic

    Clang 3.3 with -O2 optimisations is especially picky about arithmetic
    on NULL pointers. This undefined behavior is turned into optimized out
    NULL checks by clang 3.3. Fix the undefined behavior by checking against
    the pointer directly, without going back and forth around NULL with
    pointer arithmetic.

    Reported-by: Zifei Tong <soariez@gmail.com>
    Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: Resource leak in ust registry

Fix coverity issue 1019918.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: dereference after null check in UST registry

Fix coverity issue 1132896.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: unchecked return value in ust app delete

Fix coverity issue 1132897.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: resource leak in enable-event command

Fix coverity issue 1129187.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: bad logical check of error codes

Fixes #701

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: remove useless assert

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: string format with unsigned value

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: remove unused code in session daemon

This also removes unused data structure in an unit test.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: possible use after free

Fixes coverity issue 1135328 and 1135329

Signed-off-by: David Goulet <dgoulet@efficios.com>
Tests: add regression test for Java JUL support

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: fields alignements in live protocol

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: close connection on incompatible version check

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: add missing file for dist tarball

Signed-off-by: David Goulet <dgoulet@efficios.com>