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>
Write TCP JUL port in the lttng's rundir

The default name is jul.port and this file will be read by the JavaAgent
at init time so it can connect to a custom port without recompiling the
Java application or modifying the Java application with a sessiond port
option.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: remove the rundir at the end of the cleanup

Signed-off-by: David Goulet <dgoulet@efficios.com>
Live: send the number of streams in list_sessions

This allows the viewer to quickly know if a session is really active or
just created and idle. Before this patch, we had to attach to a session
to discover the number of streams active in that session.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Live unit test

The actual test :
- connect to the relayd on localhost
- list the sessions (should find only one)
- attach to the first session
- receive all the streams
- get all the metadata
- get one index per stream
- get one data packet

Then the session is stopped, destroyed and the daemons killed.

Two tests are also added just to for the lttng commands with a --live
session.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Implement live viewer SEEK_LAST

When attaching to a live session, the viewer can now specify that it
wants to only receive the new packets instead of receiving the trace
from the beginning.

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