Fix: add missing pollset reset in relayd listener thread

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: force the poll() return value to be nb_fd

With poll(), we have to iterate over all fd in the pollset since it is
handled in user space where we don't have to with epoll.o

This is a first patch to fix the fact that we should iterate over the
number of fd the lttng_poll_wait() call returns which is for epoll the
number of returned events and with poll the whole set of fd.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: use the poll wait ret value when iterating on fd(s)

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Set classes of traffic in high_throughput_limits

This patch creates 2 classes for the bandwidth limited test instead of
one. The intent is to have multiple queues in the kernel instead of just
one. That way we can prioritize the control port over the data port and
make sure it gets its share of the bandwidth.

With this update, the control port gets 1/10th of the limit and the data
get the remaining 9/10th. If unused, the data connection can borrow the
remaining bandwidth.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: remove bash quote when starting relayd in tests

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: remove ua_sess->started assert on stop trace

It's totally possible that a start failed for a specific app but the
started flag is set for the global session making a stop trace possible
on a failed started session.

The assert is no longer valid since this code flow is possible.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: add missing goto pending if data is inflight

There was only a detection for data NOT inflight and for data inflight,
if a relayd was found, was simply exiting the loop and return no data
pending.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: cppcheck linter cleanups

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: poll and epoll fd set reallocation

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: prioritize control socket communication in relayd

Add the LTTNG_POLL_GET_PREV_FD for the relayd listener thread that needs
to access the previous valid fd during a poll loop.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: flag metadata stream on quiescent control cmd

For the relayd, when doing a quiescent control command, we have to flag
the corresponding metadata stream or else it will simply stay alive
until a close stream and always returning that data is inflight at the
end data pending command.

Add a stream id to the relayd command so the relayd can identify which
stream to flag.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: possible invalid free in kernel thread

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: don't print usage when listing fails

Fixes #414

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: handle consumer data pipe read error

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: handle EINTR for every read()

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: DBG statement in relayd

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: change ERR/PERROR statement to DBG

Most of the explanation is added as comments in the code.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: sessiond write() to handle EINTR

Signed-off-by: David Goulet <dgoulet@efficios.com>
run-report: Use libtool wrapper to spawn the sessiond for tests

The run-report script was using the sessiond binary generated via
libtool under the ".libs/" folder. When using this binary, the consumerd
used when starting the sessiond is the one installed system-wide (if
any). This could lead to tests failures if no consumer are installed in
the system or any version mismatch occurs.

This commit fix this by using the consumerd that was built with libtool
in the local source tree.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
run-report: Restore SIGPIPE default handler in subprocess calls

Python override the SIGPIPE default handler because it prefers to check
every write and raise an IOError exception rather than taking SIGPIPE
[1].

This behavior has the unfortunate side-effect of polluting stdout with
broken pipe messages on shell pipelines invocations (e.g. echo foo |
grep something | etc.) in shell scripts spawned via subprocess.Popen().

This commit fix the polluting of stdout by restoring the default SIGPIPE
handler on subprocess calls.

[1] - http://bugs.python.org/issue1652

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>