Fix: add consumer wake up pipe to avoid race

UST application will notify the wait_fd pipe for every subbuffer that it
writes and ready to be consumed. However, on *high* load systems, this
1:1 property can fail if the pipe gets filled up. For performance
reason, UST will ignore this error and continue since it can't wait for
the pipe to clear up.

This triggers a race condition where we have *one* wake up on the UST
pipe for potentially multiple subbuffers. A data pending command will
wait forever on streams that still has data but the data thread could'nt
consumed them because of this 1:n possible race. Using the stop command
without waiting would mean a memory/fd leak of the stream.

Thus, we add a consumer wake up pipe here that notifies the data thread
if there is still data to be read after a successful read subbuffer
call. With this, we end up handling the residual buffers if any since
the data thread is always notified when there is still data to be read.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: take session list lock when listing tp

This is important since the list tracepoints command access the
application socket to ask the application for its TPs. The session list
lock protects the ordering of message for those sockets.

This was triggering out of order message between the session daemon and
an application thus triggering undefined behavior.

Fixes #774

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: don't print stream name in error message

The stream received, in per UID, is actually a temporary stream object
that only contains the UST object data which is the relevant part for
UST to use.

Thus on error the name was random data thus print the valid handle
descriptor instead of invalid data.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: use after free of a relayd stream

A race could occur with a stream destruction and a control connection
being destroyed emptying its recv_list. A freed stream could still be in
the list thus having a use after free during the connection destroy.

That was triggering undefined behavior from infinite looping to
segmentation faults.

We've observed this issue on high load stress test. A relayd received
all the stream but NOT the streams sent command which empty the list.
This can happen if a start tracing never occured or failed on the
application side thus the close stream command is sent to the relayd
freeing the stream before it is removed from that list.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: don't quiet the consumer if opt_quiet is not set

Signed-off-by: David Goulet <dgoulet@efficios.com>
Add 'dynamic-inst-release' to travis-ci
Add instrument target data to enable-command struct
Send enable-event commands with instrument target

Create a static function enable_event() to deal with all possible
permutations of data that accompany with the enable-event command:
- all events / some events
- no filter / a filter
- no exclusions / some exclusions
- no instrument target / a instrument target

Wrap existing functions lttng_enable_event(),
lttng_enable_event_with_filter() and lttng_enable_event_with_exclusions()
with the new static enable_event() functions without breaking API.

Create a new lttng_enable_event_with_target() function to handle the
instrument target data. Note that it is not possible to enable events
with excusions together with instrument target, since exclusions only
work with wildcard events.
Parse and forward instument probes

Report error if userspace probes created with wildcard events.
Add usage for userspace instrumented probes
Handle enable_event command with instrument target

Define a structure holds the event instrument target data. The last
data item is a flexible array that contains a variable number
of target path.

Add instrument target data to the prototype of cmd_enable_event(),
and process the instrument target data form clients in the function.

Add error codes of processing instrument traget data.
Handle instrument target in cmd_enable_event()

Add instrument target data to the prototype of event_ust_enable_tracepoint().
Handle instrument target in event_ust_enable_tracepoint()

Add instrument target data to the prototype of trace_ust_create_event()
and trace_ust_find_event().

Update the test_ust_data unit test with the new prototype.
Handle instrument target in trace_ust_create_event()

Copy instrument target and probe information from client.

Free allocated instrument target data when destroying events.

Also remove unused LTTNG_EVENT_FUNCTION_ENTRY event type.
Handle instrument target in trace_ust_find_event()

Add instrument target as a ltt_ust_ht_key and handle it in function
trace_ust_ht_match_event() and add_unique_ust_event().
Add unit test for enabling events with instrument target
Add ust event probe UST ABI to internal copy

Add definition of structure lttng_ust_event_probe_attr to our
internal copy of UST ABI definitions.

Add probe data to lttng_ust_event structure.
Copy instrument target data in shadow_copy_event()

Add instrument target data to ust_app_event struct.

In delete_ust_app_event(), free the copied instrument target data,
and also remove a redundant NULL check.
Add instrument target data to find_ust_app_event()

Add instrument target data to the prototype of find_ust_app_event()
and wherever it is called.

In ht_match_ust_app_event(), use instrument target as one of the
matching criteria.

Add instrument target as a key in add_unique_ust_app_event().
Set instrument target in ust-side when creating event

Add a new function set_ust_event_target() that calls the ust-side
function that sets the instrument target to an event.

Call set_ust_event_target() in create_ust_event().