Fix: add missing VALGRIND ifdef checks and documentation

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: miscellaneous memory handling fixes

Issues found with Valgrind:

- Uninitialized memory sent through sendmsg,
- Uninitialized realloc memory,
- Erroneous pointer arithmetic in jul_list_events(),
- Memory leaks in kernel_consumer_add_channel(),
  kernel_consumer_add_metadata(),
- Memory leak (snapshot_destroy missing hash table cleanup),
- Uninitialized poll/epoll memory on realloc.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: scanf unbounded input

Awaiting a proper cleanup (introducing nscanf), do what we can to
validate the scanf input using its utterly broken API.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: consumerd errors on exit

- The LTTNG_CONSUMER_STOP command is not used by sessiond anymore, so
  deprecate it,
- Ensure that the normal teardown (with signal handler) does not trigger
  a health error in consumer daemon by distinguishing between errors and
  "should exit" with different lttng_consumer_poll_socket() return values.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Comments fix: lttngerr.h -> error.h (./Changelog:754)

Signed-off-by: Jonathan Rajotte <jonathan.r.julien@gmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: perror on index directory creation error

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: wrong condition on startup for low-activity streams

If we only received and sent one index, we should not be in the retry
condition.
The rstream->total_index_received == vstream->last_sent_index is checked
before.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: missing big endian conversion for one index field

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Revert "Fix: wrong condition on startup for low-activity streams"

This reverts commit d3aac146d0800fe9820d51e5b9fa52e7543c1237.

Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: only create UST metadata on start trace

Fixes #739

Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Update changelog with stable 2.3 and 2.4 branch

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: kernel channel destroy on consumer if sent

An enable-channel immediately followed by a destroy session triggered an
assert on the consumer followed by the shutdown of the consumer thread
for the kernel.

This fix make sure we don't ask the consumer to destroy a channel if not
previously sent to it and handle not found channel on destroy.

Fixes #643

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: lttng list -u <name> should only list UST

Fixes #654

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: report error if consumer can't be spawned

On error of the UST consumer execl(), we now exit the forked process
like the kernel does.

Furthermore, fix an error handling value when timing out when waiting
for the consumer to bootstrap thus returning an error to the client and
not continuing with the command thinking that the consumer was actually
spawned.

So, the expected behavior is to wait for the pthread condition and if a
timeout is seen, the client is informed thus making the client command
hang for the default timeout value of 30 seconds.

Fixes #702

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: add missing relayd option to man page

Fixes #706

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: don't start session if no channel

This adds a new error code that indicates that the session contains NO
channel.

Fixes #715

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: forbid session name creation if contains /

This adds a validation function for session name which for now denies
any session name containing '/'.

This is in response of bug #721 that actually uses a path as a session
name such as "test/../session1" which would then be concatenated to the
session path adding a relative path to it making this a serious security
issue.

Because of this issue, this is backported from master up to stable-2.3.

Fixes #721

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: flag that kernel streams FDs has been sent

Flag the session *after* every stream was successfully sent.

Fixes #731

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: format + PACKAGE_URL for dynamic printing

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: possible NULL deref. in sessiond error path

Fxies #735

Signed-off-by: Stefan Seefeld <stefan@codesourcery.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>