Extras: fix checkpatch.pl to use 4 spaces for a tab

Signed-off-by: David Goulet <dgoulet@efficios.com>
Add pidfile creation for lttng-sessiond

This also adds a pidfile function to common/utils.c so it could be used
by the all binaries needing this feature.

Fixes #276

Signed-off-by: David Goulet <dgoulet@efficios.com>
Add internal kernel channel destroy function

The internal representation of a kernel channel in the session daemon
now has a session pointer that points to the associated session. This is
needed so when we destroy a channel, we can update the channel count of
the session if available.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Destroy created kernel channel on enable all error

If we had to create a channel for an enable all tracepoint call (-a -k)
and the enable fails, destroy the created kernel channel.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Make sync_file_range() usage optional

Under uClibc, sync_file_range() is not available under all
architectures, so we fall back to fdatasync() in this case.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: remove duplicate set ust event filter

Signed-off-by: David Goulet <dgoulet@efficios.com>
Refactor ust-app create session

This function was basically a mess for returned values. A valid pointer
that could be a created or already existing session, NULL on error or -1
on disconnect error...

Now, it returns 0 on success or a negative errno code. It populates the
ust app session pointer parameter given by the caller and sets to 1, if
available, the is_created parameter if we did in fact create a new
session.

The motivation behind that was to be able to know if the session was
created or not so we could do a cleanup aftwerwards if any error on the
code path requires wipping the session object. This patch uses that for
the case of a create channel failure just after the session creation. It
now wipes the session if it was created.

Furthermore, this has been error prone in the past by forgetting to
handle the -1 error value being in a pointer variable.

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