Add coding style document

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add CodingStyle to tarball

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: clang llvm warnings

Mostly fix unsigned expression and implicit conversion.

URCU still shows warnings but irrelevant.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Improve delete of configuration

Adding functions to encapsulate the configuration delete. Test if path to
configuration exists before attempting to remove it.

* fixed braces and goto name

Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com>
Add destroy all session option

Destroy was limited to one session at a time. The option -a, --all destroys all
registered sessions at once.

* fixed braces

Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com>
Update documentation for destroy all option

Document the new option -a, --all of lttng destroy

Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com>
Fix comments formating in conf.c

Comments should be indented with one space only.

Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Update lttng-ust-abi.h for event field listing

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Implement event fields listing

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
cleanup output indentation for field listing

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: ust_app_list_events should return -ENOSYS when no UST

Caller thinks that memory is allocated, and incorrectly dereferences a
NULL pointer if we return 0 rather than -ENOSYS.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Update lttng-ust header copy for disabled UST compilation

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: close all file descriptors when executed as daemon

Both sessiond and consumerd support the option "-d" to run as daemon. In
some specific cases, e.g. when launched from dpkg installation scripts,
file descriptors 3, 4, 5 are left open and don't seem to have O_CLOEXEC
flag set, so the install script hangs because the sessiond still holds a
reference to them. daemon(3) only closes standard FD 0, 1, 2.

Fix this issue by closing all file descriptors after calling daemon(3).
Note: we make sure no file descriptor is opened before calling daemon(3)
by moving the init_thread_quit_pipe() call after the FD close.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Create unix.c/.h for UNIX socket communication

Simply split some content of sessiond-comm.c/.h to those two files for a
clearer code.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: move memset in channel_set_attr after NULL check

Signed-off-by: Danny Serres <danny.serres@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Create kernel-consumer.c/.h and consumer.h

Contains function call to send data to the kernel consumer (for now
session and channel streams).

Nothing new, code has just been moved to simplify main.c and partition
portion of code for clearer and easier understanding.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: Change the type of enabled in lttng_event to a signed int

Signed-off-by: Danny Serres <danny.serres@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Add lttng URI support and default network ports

This commit simply adds the lttng_uri API/ABI to the upstream branch.
Three functions are provided by common/uri.h and are usable by linking
with libcommon.

The default network ports are also added for network streaming for both
control and data stream.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: enable event with different loglevel error

This following example was NOT returning a correct error message.
"event1" is set with a loglevel "TRACE_CRIT". The normal behavior here
is that once enabled, you can not change the loglevel of the enable
event on the tracer side with a second command. It now returns a new
error message like so:

$ lttng enable-event event1 --loglevel-only TRACE-CRIT -u
$ lttng enable-event event1 --loglevel-only TRACE-WARNING -u
[...] Event already enabled with different loglevel

This commit makes the session daemon verify if _both_ the name and
loglevel are the same when enabling an event or else an error is
returned.

Also, the session daemon will continue enabling events and not return an
error is the loglevel does not match event for ust app on the tracer
which returns an EPERM at that stage. This is to address the case where
two applications have the same event name but with different loglevel.

Reported-by: Tan Dung Le Tran <tan.dung.le.tran@ericsson.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add network transport layer to sessiond-comm

Only import the library files in sessiond-comm/ directory for network
communication supporting both TCP and UDP protocols with IPv4 and IPv6.

First layer needed for network streaming and communication with the
upcoming lttng-relayd daemon.

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