Fix: arguments in the wrong order for fd-limit

This is related to a bug we've been seeing with a very HIGH load of
applications registering at the same time where the get/put counters get
out of sync. exhausting the fd pool quite rapidely even though there was
no fd leak.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: missing LTTNG_OK return value for snapshot

After a successful kernel snapshot, the ret = LTTNG_OK was missing thus
returning 0 to the caller which was expecting LTTNG_OK.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: application SIGBUS when starting in parallel with sessiond

There is a race between application startup and sessiond startup, where there
is an intermediate state where applications can SIGBUS if they see a zero-sized
shm, if the shm has been created, but not ftruncated yet.

On the sessiond side, we need to ensure that the shared memory is writeable by
applications as long as its size is 0, which allow applications to perform
ftruncate and extend its size.

On the UST side, another commit needs to ensure that UST can read the shared
memory file descriptor with a read() system call before they try accessing it
through a memory map (which triggers the SIGBUS if the access goes beyond the
file size)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: typo in --sig-parent help

Signed-off-by: David Goulet <dgoulet@efficios.com>
Update version to v2.3.1

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: comparison of unsigned value agains < 0

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: implicit conversion of enum types in sessiond

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: implicit conversion of enum types in consumer

This actually remove the use of LTTNG_ERR* code in the sessiond/consumer
protocol since it should NOT be used and some comparison of enum
(lttng_error_code vs lttcomm_return_code) were broken and dangerous.

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

Conflicts:
	src/bin/lttng-sessiond/ust-consumer.c
	src/common/kernel-consumer/kernel-consumer.c
Add libuuid as dependency in README

Signed-off-by: Zifei Tong <soariez@gmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: comparison of unsigned enum expression >= 0

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

Conflicts:
	src/common/ust-consumer/ust-consumer.c
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: 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 bad code from previous backport patch

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: wrong comment in snapshot public API

Reported-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>