Fix: don't delete stream from connection recv list

We don't need to delete them from the list during a connection destroy
because it's only a reference to the stream that might be valid or not
during the connection destroy. There is no need at all to access the
stream's pointer at that point.

Commit cd2ef1ef1d54ced9e4d0d03b865bb7fc6a905f80 did not fixed the full
issue so this should fix the use after free race for good.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Update ChangeLog with 2.4.1 release

Signed-off-by: David Goulet <dgoulet@efficios.com>
Insert V4L2 instrumentation module on session start

Requires V4L2 instrumentation patch for lttng-modules.

Signed-off-by: Wade Farnsworth <wade_farnsworth@mentor.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Add MIT license header to session.xsd

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: XML declaration must be at beginning of XSD file

Move down license information to fix the parser error :
XML declaration allowed only at the start of the document

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

Ok, so there are a lot of problems with this function (sorry :|). Taking
the regex road is probably to complicated for nothing, so here is a
version without regexes.

I added many test cases as suggested by Sandeep Chaudhary and Daniel
Thibault. I tested on both Intel 32 and 64 bits.

Fixes #633

Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: replace 1 for true in libxml checking

Initial bug on ./configure:
checking for libxml - version >= 2.7.6... yes (version 2.9.1)
./configure: line 5137: 1: command not found

Signed-off-by: Jonathan Rajotte <jonathan.r.julien@gmail.com>
Override the session.xsd path with an ENV. variable

The LTTNG_SESSION_CONFIG_XSD_PATH environment variable can be used to
specify a path which contains the session configuration schema. This
will allow save-load tests to be ran without installing the XSD on the
system.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Use the in-tree session.xsd in test_load

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: Racy event validation in tests

This pattern is fundamentally racy:

$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1 &

[...]

while [ -n "$(pidof $TESTAPP_BIN)" ]; do
   sleep 1
done
pass "Wait for application end"

[...]

tracing_teardown

validate_trace $EXACT_EVENT_COUNT

It is possible that the check for "pidof $TESTAPP_BIN" occurs _before_
the execve() of the applications (starting the applications in background
with & is basically a clone() + execve()). The consequence is that the check
succeed, never waiting for any applications to finish and then the tracing
sessions are prematurely teared down. Thus the resulting trace contains only
some events. We then validate for a fixed number of events and thus the test
fails caused by this racy scheduling situation.

The fix is to start the applications in foreground instead of background.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Clarify limitations of the --syscall flag with enable-event command

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

This patch enables lttng-tools to run on top of glibc 2.8.
Overall it fixes 2 things:
1. No support for epoll_create1(..) and EPOLL_CLOEXEC.
2. No support for htobe/betoh

For 1, we revert back to epoll_create() and then sets CLOEXEC through
fcntl instead.

For 2, we define htobe/betoh as part of the compat/endian.h and make
sure that any users of those functions actually include compat/endian.h
instead of implicit include of system endian.h

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tested-by: Jesper Derehag <jderehag@hotmail.com>
Signed-off-by: Jesper Derehag <jderehag@hotmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Implement LTTng-UST perf counters support

Introduce perf:cpu:* and perf:thread:* performance monitoring counter
contexts. perf:cpu: is used for kernel tracing, and perf:thread: is used
for UST. perf:* is kept for backward compatibility, but not shown in
lttng add-context --help anymore.

Example usages of performance counters have been adapted to this new
interface.

For the lttng.h API We introduce LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER
and LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER as the API counterparts of
the new command line options. LTTNG_EVENT_CONTEXT_PERF_COUNTER is kept
for backward compatibility.

For ABIs with the tracers, introduce the new
LTTNG_UST_CONTEXT_PERF_THREAD_COUNTER to support this new UST feature.
Rename LTTNG_KERNEL_CONTEXT_PERF_COUNTER to
LTTNG_KERNEL_CONTEXT_PERF_CPU_COUNTER, following the same change in
lttng-modules (keeping the same enum entry value).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: rename of perf counter context

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Test for UST perf counters

Works both in physical and virtual machines.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Add UST perf test in make check on x86

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: add JUL filter to UST event on logger_name

This is to avoid having the JUL event copied in each sessions. See
ticket description for more details.

To achieve this, JUL filtering has been added to fix that bug.

Fixes #773

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: Out of tree build fails in libconfig

libconfig_la_CPPFLAGS should also include the top-level AM_CPPFLAGS.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: Don't include the binary in the live test's EXTRA_DIST

Adding the binary in EXTRA_DIST causes the "dist" target to fail
with a "No rule to make target libtap.la" error.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: add missing source file for make dist

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