Basic handling of the live timer

Make the metadata timer thread more generic, we now handle the live
timer in here as well.
Introduce the new LTTNG_CONSUMER_SIG_LIVE, for now handled as a simple
printf.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Create relayd session from the sessiond

Move the relayd session creation from the consumer to the relayd. No
change in behaviour expected here, just prepare for the next patch to
allow the sessiond to pass additionnal parameters in the relayd session
creation required for live tracing (hostname, session name, flags, etc).

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Create relayd session with live parameters

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Relay listen on 2 additionnal ports

Copy the structure of the threads management of the main relayd for the
live viewer.
So we have 3 new threads live_listener, live_dispatcher, live_worker. It
maybe is a lot of duplicated code, but it is too early in the dev to
identify precisely the code that could be merged.
For now we don't do anything useful on these ports, but that's the next
step.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Cleanup line-wrap, add lttng-viewer.h

Viewer command VIEWER_VERSION working (tested with separate test program
using only lttng-viewer.h as "internal" header).

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Viewer list sessions

Add a session_list HT in the relayd and allow the viewer to list the
sessions.
Introduce a relay_local_data struct to have a simple way to share data
between threads.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Attach session, list streams, get_next_index

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
send data_packet working

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
metadata flag

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
HT add_str (not unique)

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Match ctf_traces

Introduce a new per-connection HT indexed by path_name and accepting
duplicate keys.
When a new metadata stream arrives, we create a new ctf_trace struct,
assign it a unique ID and match all streams with the same path to this
ctf_trace.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Handle the synchronisation on metadata

If new metadata is available when the viewer requests an index, we set
the new_metadata flag in the index packet. If it requests a data packet
and new metadata is available we inform it to update its metadata first.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
send ctf_trace_id to the viewer

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
send metadata working

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Ioctl to get the currrent timestamp

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Inactive stream beacon

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
REVIEW CAREFULLY : test for new metadata at each packet

After sending each data packet in live, we need to check if new metadata
is available before sending the index informing the viewer it can read
the trace.
Since the data and the metadata are handled by two different threads,
this patch introduces a rendez-vous point : if new metadata is
available, the data thread flushes the metadata stream and waits on a
conditionnal variable. When the metadata thread finishes to send its
data, it wakes up the data thread which can send its index.

That way, the viewer is informed new metadata is available before
attempting to read a packet that might require an update of the
metadata.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
relicense lttng-index and lttng-viewer to BSD

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>