Fix: FD leak in liblttng-ust-ctl

Make sure wait/wakeup stream and channel FDs are closed at teardown.
This led to FD leaks on the consumer daemon when the relay daemon
disconnects unexpectedly.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: add LTTngEvent class to fix delayed logger

This commit introduces a new object called LTTngEvent that represent a
LTTng event containing some attributes, for now loglevel data.

Instead of moving event string name around, this object is created once
and kept in the log handler so once a record is publish we can match
attributes such as loglevels.

This has to be done in order to fix the issue where we have a Logger
that appears later on during runtime (with the timer that poll every 5
seconds). With a created event object we can lookup back the event
attributes and enabled it accordingly. Same goes with the * (all events)
where we now keep the loglevel values process wide so we can force the
new events to use it.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: malloc libc instrumentation wrapper

calloc and realloc wrt dlsym and dlerror can trigger segmentation
faults. Ensure that we fully populate the allocator symbols all at once,
and also ensure that we use the static allocator while doing the dlsym
lookups.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cleanup: add lttng_ust_malloc_wrapper_init prototype to header

Ensure the weak symbol prototype matches the non-weak function.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: work-around glibc lying about dlsym()/dlerror() leafness

Especially in the LTTng-UST malloc instrumentation, we run into the
following situation:

1) Our calloc wrapper is called,
2) we setup the static allocator,
3) we call dlsym() to lookup the symbol of the real allocator,
4) dlsym() calls into calloc(), which is overridden by our own wrapper.
   Our calloc does not see that the static allocator has been set,
   because the stores setting up the static allocator have been optimized
   away by gcc-4.8 (in O2), because the dlsym() prototype declares it
   with the "leaf" attribute, and thus we end up doing an infinite
   recursion, and eventually a segmentation fault.

Thanks to Alexander Monakov for pointing out the culprit of this glibc
bug.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cleanup: remove extra space in dlerror wrapper

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

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