lttng-ust.git
4 years agoAdd userspace vuid/vgid contexts C009-19
Michael Jeanson [Tue, 12 Feb 2019 15:40:48 +0000 (10:40 -0500)] 
Add userspace vuid/vgid contexts

Add a context for each available namespaced user and group IDs

  * vuid : real user ID
  * veuid : effective user ID
  * vsuid : saved set-user ID

These are the IDs as seen in the current user namespace, see
user_namespaces(7) and credentials(7) for details on each type.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
4 years agoAdd userspace namespace contexts
Michael Jeanson [Tue, 12 Feb 2019 15:38:25 +0000 (10:38 -0500)] 
Add userspace namespace contexts

Add a context for each available kernel namespace which currently are :
cgroup, ipc, mnt, net, pid, user and uts. The id chosen to identify the
namespaces is the inode number of the file representing each one of them
in the proc filesystem.

This was introduced in kernel v3.8.0, if any of these context are
enabled on a system running an older kernel, zero will be returned.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
4 years agoFix: timestamp_end field should include all events within sub-buffer
Mathieu Desnoyers [Tue, 30 Apr 2019 15:23:44 +0000 (11:23 -0400)] 
Fix: timestamp_end field should include all events within sub-buffer

Fix for timestamp_end not including all events within sub-buffer. This
happens if a thread is preempted/interrupted for a long time between
reserve and commit (e.g. in the middle of a packet), which causes the
timestamp used for timestamp_end field of the packet header to be lower
than the timestamp of the last events in the buffer (those following the
event that was preempted/interrupted between reserve and commit).

The fix involves sampling the timestamp when doing the last space
reservation in a sub-buffer (which necessarily happens before doing the
delivery after its last commit). Save this timestamp temporarily in a
per-sub-buffer control area (we have exclusive access to that area until
we increment the commit counter).

Then, that timestamp value will be read when delivering the sub-buffer,
whichever event or switch happens to be the last to increment the commit
counter to perform delivery. The timestamp value can be read without
worrying about concurrent access, because at that point sub-buffer
delivery has exclusive access to the sub-buffer.

This ensures the timestamp_end value is always larger or equal to the
timestamp of the last event, always below or equal the timestamp_begin
of the following packet, and always below or equal the timestamp of the
first event in the following packet.

This changes the layout of the ring buffer shared memory area, so we
need to bump the LTTNG_UST_ABI version from 7.2 to 8.0, thus requiring
locked-step upgrade between liblttng-ust in applications, session
daemon, and consumer daemon. This fix therefore cannot be backported
to existing stable releases.

Fixes: #1183
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoHarmonize rw_prog_cxx_works macro across projects
Michael Jeanson [Tue, 16 Apr 2019 20:17:31 +0000 (16:17 -0400)] 
Harmonize rw_prog_cxx_works macro across projects

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoUpdate macros from the autoconf archive
Michael Jeanson [Tue, 16 Apr 2019 20:17:30 +0000 (16:17 -0400)] 
Update macros from the autoconf archive

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoust-ctl API: clarify getter usage requirements
Mathieu Desnoyers [Wed, 10 Apr 2019 15:14:03 +0000 (11:14 -0400)] 
ust-ctl API: clarify getter usage requirements

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: don't access packet header for stream_id and stream_instance_id getters
Mathieu Desnoyers [Wed, 10 Apr 2019 14:31:47 +0000 (10:31 -0400)] 
Fix: don't access packet header for stream_id and stream_instance_id getters

The stream ID and stream instance ID are invariant for a stream, so
there is no point reading them from the packet header currently owned by
the consumer (between get/put subbuf).

Actually, the consumer try to access the stream_id from the live timer
when sending a live beacon without getting the reader subbuffer first.
Doing so is racy against producers. In typical live scenarios
(non-overwrite channels), the producers will always write the same
stream id and stream instance id values at the same header offsets,
which will "work", except for the initial state of an empty buffer:
the value "0" will be returned (erroneously).

For the less frequently used scenario of a live session with "overwrite"
channels, this is handled by issuing a CHAN_WARN_ON, which disables
tracing for the channel, and prints warning to the consumerd console
when running consumerd with LTTNG_UST_DEBUG=1.

In the case where a ring buffer does not have any data ready, it makes
no sense to try to get a subbuffer for reading anyway, so the approach
was broken.

So return the stream id and stream instance id from the internal
data structures rather than reading it from the ring buffer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoAdd LTTNG_PACKED ifdefs to validate that it is defined
Mathieu Desnoyers [Tue, 26 Mar 2019 16:41:30 +0000 (12:41 -0400)] 
Add LTTNG_PACKED ifdefs to validate that it is defined

If LTTNG_PACKED is used to specify whether a structure is packed, but we
end up forgetting inclusion of lttng/ust-compiler.h (which defines it),
we end up silently _not_ packing the data structure, because
LTTNG_PACKED will be considered to be an identifier by the compiler,
and therefore simply ignored.

There are no such instances in lttng-ust, but let's add a ifdef check.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoReport perf integration status at configure
Michael Jeanson [Wed, 20 Mar 2019 21:02:25 +0000 (17:02 -0400)] 
Report perf integration status at configure

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agocompat: work around broken _SC_NPROCESSORS_CONF on MUSL libc
Michael Jeanson [Wed, 20 Mar 2019 15:07:35 +0000 (11:07 -0400)] 
compat: work around broken _SC_NPROCESSORS_CONF on MUSL libc

On MUSL libc the _SC_NPROCESSORS_CONF sysconf will report the number of
CPUs allocated to the task based on the affinity mask instead of the
total number of CPUs configured on the system.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoCode cleanup in contexts
Michael Jeanson [Thu, 14 Mar 2019 16:31:35 +0000 (12:31 -0400)] 
Code cleanup in contexts

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agodoc: remove repeated word in coding style
Sebastien Boisvert [Thu, 14 Mar 2019 12:56:15 +0000 (08:56 -0400)] 
doc: remove repeated word in coding style

Signed-off-by: Sebastien Boisvert <seb@boisvert.info>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agotap-driver.sh: flush stdout after each test result
Michael Jeanson [Thu, 14 Mar 2019 15:39:59 +0000 (11:39 -0400)] 
tap-driver.sh: flush stdout after each test result

This is useful in a CI system where stdout is fully buffered and you
look at the console output to see which test is hanging.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoMove wait_shm_mmap initialization to library constructor
Jonathan Rajotte [Fri, 8 Mar 2019 15:01:12 +0000 (10:01 -0500)] 
Move wait_shm_mmap initialization to library constructor

Prevent us from deadlocking ourself if some glibc implementation
decide to hold the dl_load_* locks on fork operation.

This happens on Yocto Rocko and up when performing python tracing (import
lttngust). Why Yocto decided to patch glibc this way is a mystery
(ongoing effort) [1][2][3].

Anyhow, we can prevent this by moving the initialization of the
wait_shm_mmap to the library constructor since the dl_load_* locks are
nestable mutex.

Nothing in the git log for the wait_shm_mmap indicate a specific reason
to why it was done inside the listener thread. Doing it inside
wait_for_sessiond can help in some corner cases were /dev/shm
(or the shm path) files are unlinked. This is not much of an advantage.

[1] From yocto master branch: ee9db1a9152e8757ce4d831ff9f4472ff5a57dad
[2] From OE-Core: f2e586ebf59a9b7d5b216fc92aeb892069a4b0c1
[3] https://www.mail-archive.com/openembedded-core@lists.openembedded.org/msg101186.html

This was tested on a Yocto Rocko qemu x86-64 image with python agent
enabled.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: additional compiler barriers for procname context
Mathieu Desnoyers [Thu, 14 Feb 2019 21:39:57 +0000 (16:39 -0500)] 
Fix: additional compiler barriers for procname context

Use additional volatile load/stores and compiler barriers to make
sure the compiler do not reorder the nesting counter wrt procname cache
content load/stores.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: procname context async-signal safety
Mathieu Desnoyers [Thu, 14 Feb 2019 21:14:42 +0000 (16:14 -0500)] 
Fix: procname context async-signal safety

Ensure an instrumented signal handler interrupting the procname
context code will not write a partial process name string into the
trace context.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoCleanup vtid/vpid context caches
Mathieu Desnoyers [Thu, 14 Feb 2019 20:47:34 +0000 (15:47 -0500)] 
Cleanup vtid/vpid context caches

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoCleanup: fix typo 'acces' -> 'access'
Michael Jeanson [Thu, 7 Feb 2019 20:24:31 +0000 (15:24 -0500)] 
Cleanup: fix typo 'acces' -> 'access'

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: Initialize fd field of struct lttng_ust_elf to -1 at allocation
Jonathan Rajotte [Wed, 14 Nov 2018 19:38:37 +0000 (14:38 -0500)] 
Fix: Initialize fd field of struct lttng_ust_elf to -1 at allocation

In rare cases when the executable cannot be open, using a default value
of zero lead to invalid close call and fd tracker removal.

fixes #1171

Reported-by: Stefan Palade <stefan.palade@windriver.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoCleanup: test Makefiles
Michael Jeanson [Mon, 14 Jan 2019 21:29:28 +0000 (16:29 -0500)] 
Cleanup: test Makefiles

Remove unnessary complexity and use specific names for test programs.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoAdd silent mode to examples Makefiles
Michael Jeanson [Thu, 20 Dec 2018 20:22:42 +0000 (15:22 -0500)] 
Add silent mode to examples Makefiles

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoAdd silent rules support for docs
Michael Jeanson [Thu, 20 Dec 2018 20:22:41 +0000 (15:22 -0500)] 
Add silent rules support for docs

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoUse config.h to define SONAME major number
Michael Jeanson [Thu, 20 Dec 2018 20:22:40 +0000 (15:22 -0500)] 
Use config.h to define SONAME major number

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoUse a variable to select the dlopen lib in Makefiles
Michael Jeanson [Thu, 20 Dec 2018 20:22:39 +0000 (15:22 -0500)] 
Use a variable to select the dlopen lib in Makefiles

Instead of multiple conditionnals, it makes for cleaner and more
readable Makefiles.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoAdd hello-many to gitignore
Michael Jeanson [Wed, 12 Dec 2018 21:41:28 +0000 (16:41 -0500)] 
Add hello-many to gitignore

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoAdapt lttng-ust to use multiflavor symbols from liburcu 0.11
Mathieu Desnoyers [Wed, 28 Nov 2018 21:56:59 +0000 (16:56 -0500)] 
Adapt lttng-ust to use multiflavor symbols from liburcu 0.11

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoClarify lib_ring_buffer_switch_slow() requirements
Mathieu Desnoyers [Thu, 8 Nov 2018 17:42:29 +0000 (12:42 -0500)] 
Clarify lib_ring_buffer_switch_slow() requirements

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agotests: hello-many
Mathieu Desnoyers [Wed, 17 Oct 2018 20:07:56 +0000 (16:07 -0400)] 
tests: hello-many

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: sync event enablers before choosing header type
Mathieu Desnoyers [Wed, 17 Oct 2018 19:48:16 +0000 (15:48 -0400)] 
Fix: sync event enablers before choosing header type

On session start, we should allocate the event IDs before figuring
out the number of events per channel and select the proper header
type.

Without this, the number of events is always perceived to be 0,
which selects the "compact" header type.

With UST, the order of those two actions is not the only one
affecting the chosen header type: UST can receive the session
start command before all probe provider library constructors
have completed running, therefore finding less events than
eventually enabled within the process. Moreover, with per-uid
buffers, many processes end up registering events into shared
buffers. Therefore, the guess based on number of events from
the first process to use the buffer is incorrect.

Considering that we typically have applications with more than
30 events, we will modify the session daemon so it selects the
"large" header type independently of the number of events.

We still want to swap the order of the enablers sync vs header
type getter because we may revisit how session enabling is done
in a process wrt constructor completion, which may allow us to
do a more precise choice for per-pid buffers in the future.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: address shellcheck warnings/errors in example scripts
Omair Majid [Thu, 11 Oct 2018 18:28:49 +0000 (14:28 -0400)] 
Fix: address shellcheck warnings/errors in example scripts

ShellCheck points out a number of warnings in the example scripts. In
particular, a number of normal and special shell variables are not
quoted correctly.

Signed-off-by: Omair Majid <omajid@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: check for event class/instance prototype mismatch
Mathieu Desnoyers [Thu, 27 Sep 2018 19:21:16 +0000 (15:21 -0400)] 
Fix: check for event class/instance prototype mismatch

The TP_ARGS() for an event instance belonging to an event class
must have compatible types with the event class TP_ARGS().

Failure to follow this rule leads to a prototype mismatch between the
tracepoint call site and the probe function. A common effect perceived
is that events with prototype mismatch between call site and probe
function are never traced.

Fix this by enforcing a compile-time check of the event instance and
class prototypes, similarly to what is done in LTTng modules.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: race between statedump and library destructor
Mathieu Desnoyers [Thu, 20 Sep 2018 18:11:17 +0000 (14:11 -0400)] 
Fix: race between statedump and library destructor

The locking scheme for ust_lock() returns a teardown state (variable
lttng_ust_comm_should_quit) which is set by library destructor with lock
held.

It requires that when ust listener threads use this lock to protect
against concurrent accesses to a data structure, in addition to take
the lock, they need to check the return value of ust_lock() and
skip their critical section entirely if the return value indicates
that teardown is ongoing.

Iteration over all loaded libraries by lttng_ust_dl_update() starts by
iter_begin which grabs the lock, and sets data->cancel state
appropriately if teardown is ongoing. Then extract_bin_info_events()
uses the data->cancel state to skip over use of the protected structures
as needed, but iter_end() fails to take this data->cancel state into
account. Therefore, it can access data structures concurrently while
their teardown is ongoing which leads to crashes.

Fixes: #1169
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: reset procname on fork in child process
Mathieu Desnoyers [Fri, 7 Sep 2018 15:28:51 +0000 (11:28 -0400)] 
Fix: reset procname on fork in child process

lttng-ust(3) documents:

   procname
      Thread name, as set by exec(3) or prctl(2). It is recommended
      that programs set their thread name with prctl(2) before
      hitting the first tracepoint for that thread.

We can rightfully expect that this applies to the first thread created
within a child process upon fork. Reset the procname cache in the child
on fork.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoVersion 2.11.0-rc1
Mathieu Desnoyers [Thu, 6 Sep 2018 15:32:24 +0000 (11:32 -0400)] 
Version 2.11.0-rc1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: add missing stdbool.h include
Michael Jeanson [Wed, 5 Sep 2018 19:56:59 +0000 (15:56 -0400)] 
Fix: add missing stdbool.h include

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoMove symbol preventing unloading of probe providers
Francis Deslauriers [Tue, 4 Sep 2018 21:05:14 +0000 (17:05 -0400)] 
Move symbol preventing unloading of probe providers

Issue
=====
Calling dlclose on the probe provider library that first loaded
__tracepoints__disable_destructors in the symbol table does not
unregister the probes from the callsites as the destructors are not
executed.

The __tracepoints__disable_destructors weak symbol is exposed by probe
providers, liblttng-ust.so and liblttng-ust-tracepoint.so libraries. If
a probe provider is loaded first into the address space, its definition
is bound to the symbol. All the subsequent loaded libraries using the
symbol will use the existing definition of the symbol, thus creating a
situation where liblttng-ust.so or liblttng-ust-tracepoint.so depend on
the probe provider library.

This prevents the dynamic loader from unloading the library as it is
still in use by other libraries. Because of this, the execution of its
destructors and the unregistration of the probes is postponed. Since the
unregistration of the probes is postponed, event will be generated if
the callsite is executed even though the probes should not be loaded.

Solution
========
To overcome this issue, we no longer expose this symbol in the
tracepoint.h file to remove the explicit dependency of the probe
provider on the symbol. We instead use the existing dlopen handle on
liblttng-ust-tracepoint.so and use dlsym to get handles on functions
that disable and get the state of the destructors.

Version compatibility
=====================
- This change is backward compatible with UST applications and libraries
  built on lttng-ust version before 2.11. Those applications will use
  the __tracepoints__disable_destructors symbol that is now exposed
  as a weak symbol in the liblttng-ust-tracepoint.so library. This
  symbol is alway checked in 2.11 in case an old app is running.

- Applications built with this change will also work in older versions
  of lttng-ust as there is a check to see if the new destructor state
  checking method should be used, if it is not we fallback to a
  compatibility method. To ensure compatibility in this case, we also
  look up and keep up-to-date the __tracepoints__disable_destructors
  value using the dlopen-dlsym combo.

- A mix of applications/probes builds in part against 2.10 and 2.11
  also work. When setting the destructor state from a binary built
  against 2.11 headers, both old/new states are set, so a binary built
  against 2.10 will correctly see the old state. When querying the state
  from a binary built against 2.11 headers, both old and new states are
  queried, so if the state has been set from a binary built against
  2.10 headers, the old state will be set.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: Remove unused line from liblttng-ust-fd makefile
Mathieu Desnoyers [Mon, 20 Aug 2018 21:20:05 +0000 (17:20 -0400)] 
Fix: Remove unused line from liblttng-ust-fd makefile

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: add liblttng-ust dependency to liblttng-ust-fd
Vitaly Lipatov [Sat, 30 Jun 2018 09:07:34 +0000 (12:07 +0300)] 
Fix: add liblttng-ust dependency to liblttng-ust-fd

Signed-off-by: Vitaly Lipatov <lav@etersoft.ru>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: use LIBDL/LIBC_DL to select either libdl or libc
Vitaly Lipatov [Sat, 30 Jun 2018 09:07:21 +0000 (12:07 +0300)] 
Fix: use LIBDL/LIBC_DL to select either libdl or libc

Use LTTNG_UST_BUILD_WITH_LIBDL/LIBC_DL variables to choose between -ldl
and -lc.

Add a missing direct dependency against -ldl or -lc to
liblttng_ust_tracepoint_la_LIBADD.

Signed-off-by: Vitaly Lipatov <lav@etersoft.ru>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: lttng filter validator ERANGE error handling
Mathieu Desnoyers [Thu, 7 Jun 2018 16:11:03 +0000 (12:11 -0400)] 
Fix: lttng filter validator ERANGE error handling

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFilter: implement dynamic typing for load object
Mathieu Desnoyers [Mon, 25 Sep 2017 20:24:02 +0000 (16:24 -0400)] 
Filter: implement dynamic typing for load object

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFilter: add FILTER_OP_RETURN_S64 instruction
Mathieu Desnoyers [Mon, 25 Sep 2017 15:37:28 +0000 (11:37 -0400)] 
Filter: add FILTER_OP_RETURN_S64 instruction

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoPerform bitwise ops on unsigned types
Mathieu Desnoyers [Fri, 22 Sep 2017 21:03:48 +0000 (17:03 -0400)] 
Perform bitwise ops on unsigned types

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFilter: catch shift undefined behavior
Mathieu Desnoyers [Fri, 22 Sep 2017 20:00:29 +0000 (16:00 -0400)] 
Filter: catch shift undefined behavior

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFilter: implement bitwise lshift, rshift, not
Mathieu Desnoyers [Thu, 21 Sep 2017 23:43:10 +0000 (19:43 -0400)] 
Filter: implement bitwise lshift, rshift, not

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFilter: index array, sequences, implement bitwise binary operators
Mathieu Desnoyers [Thu, 22 Jun 2017 22:00:39 +0000 (18:00 -0400)] 
Filter: index array, sequences, implement bitwise binary operators

Implement indexing of array and sequence of integers, as well as bitwise
binary operators &, |, ^.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: AM_CONDITIONAL should be outside AS_IF block
Mathieu Desnoyers [Thu, 3 May 2018 19:58:44 +0000 (15:58 -0400)] 
Fix: AM_CONDITIONAL should be outside AS_IF block

Fixes:

configure: error: conditional "HAVE_JAVAH" was never defined.
Usually this means the macro was only invoked conditionally

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: build jni libs with openjdk >= 10
Michael Jeanson [Thu, 3 May 2018 19:42:54 +0000 (15:42 -0400)] 
Fix: build jni libs with openjdk >= 10

In openjdk 10, the "javah" utility used to generate c headers from java
classes was removed and replaced with an option of "javac".

When we detect "javac" but no "javah", assume we are working with
openjdk >= 10 and configure the build system to use the proper tool and
switches.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: ustfork: save and restore errno in syscall wrappers
Michael Jeanson [Mon, 5 Mar 2018 21:09:07 +0000 (16:09 -0500)] 
Fix: ustfork: save and restore errno in syscall wrappers

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: cache the result of getpid() internally
Michael Jeanson [Fri, 2 Mar 2018 22:36:26 +0000 (17:36 -0500)] 
Fix: cache the result of getpid() internally

On Linux we called getpid() directly on each tracepoint and relied on
the glibc pid cache. However, in glibc 2.25, released on 2017-02-05, the
pid cache was removed which results in a getpid syscall on each event
when the vpid context is enabled.

Remove the Linux specific case and use our internal cache all the time.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: reset cached vpid context on fork
Michael Jeanson [Fri, 2 Mar 2018 22:36:25 +0000 (17:36 -0500)] 
Fix: reset cached vpid context on fork

We currently reset the cached vtid on fork but not the vpid. This is not
a problem on Linux because we don't cache the vpid internally but call
getpid() directly and rely on the glibc pid cache.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: build example SO when PIE is enabled
Michael Jeanson [Wed, 25 Oct 2017 18:28:04 +0000 (14:28 -0400)] 
Fix: build example SO when PIE is enabled

In the example Makefiles, when building shared object libraires, make sure
we set the custom linker options after the CFLAGS/LDFLAGS so that it
overrides them. This is useful when the build system set some hardening
features like PIE in the CFLAGS.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: string comparison on incorrect length in context provider
Mathieu Desnoyers [Tue, 20 Feb 2018 14:27:23 +0000 (09:27 -0500)] 
Fix: string comparison on incorrect length in context provider

Fixes: #1154
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoSupport unloading of probe providers
Francis Deslauriers [Fri, 9 Feb 2018 20:15:25 +0000 (15:15 -0500)] 
Support unloading of probe providers

With this commit, it's now possible to dlclose() a library containing an
actively used probe provider.

The destructor of such library will now iterate over all the sessions
and over all probe definitions to unregister them from the respective
callsites in the process.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoRename lttng_ust_enum_get to lttng_ust_enum_get_from_desc
Francis Deslauriers [Fri, 9 Feb 2018 20:15:24 +0000 (15:15 -0500)] 
Rename lttng_ust_enum_get to lttng_ust_enum_get_from_desc

Change the prototype to take a descriptor instead of a char *.
Now that provider names can have duplicates enum names are not
necessarily unique.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agodlopen() liblttng-ust.so from constructor to prevent unloading
Francis Deslauriers [Fri, 9 Feb 2018 20:15:23 +0000 (15:15 -0500)] 
dlopen() liblttng-ust.so from constructor to prevent unloading

The support of probe provider dlclose() allows for the following
problematic scenario:
- Application is not linked against the liblttng-ust.so
- Application dlopen() a probe provider library that is linked against
  liblttng-ust.so
- Application dlclose() the probe provider

In this scenario, the probe provider has a dependency on
liblttng-ust.so, so when it's loaded by the application, liblttng-ust.so
is loaded too. The probe provider library now has the only reference to
the liblttng-ust.so library.  When the application calls dlclose() on
it, all its references are dropped, thus triggering the unloading of
both the probe provider library and liblttng-ust.so.

This scenario is problematic because lttng ust_listener_threads are in
DETACHED state. We cannot join them and therefore we cannot unload the
library containing the code they run. Only the operating system can free
those resources.

The reason why those threads are in DETACHED state is to quickly
teardown applications on process exit.

A possible solution to investigate: if we can determine whether
liblttng-ust.so is being dlopen (directly or undirectly) or it's linked
against the application, we could set the detached state accordingly.

To prevent that unloading, we pin it in memory by grabbing an extra
reference on the library, with a RTLD_NODELETE flag. This will prevent
the dynamic loader from ever removing the liblttng-ust.so library from
the process' address space.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoAdd probe provider unregister function
Francis Deslauriers [Fri, 9 Feb 2018 20:15:22 +0000 (15:15 -0500)] 
Add probe provider unregister function

Also, ensure that enumerations and events are removed from their
respective hashtables when _lttng_{event, enum}_destroy functions are
called.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoCleanup: Move version numbers in separate variables in configure script
Francis Deslauriers [Fri, 9 Feb 2018 20:15:21 +0000 (15:15 -0500)] 
Cleanup: Move version numbers in separate variables in configure script

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoRemove duplicate provider name checks
Mathieu Desnoyers [Fri, 9 Feb 2018 20:15:20 +0000 (15:15 -0500)] 
Remove duplicate provider name checks

It's now possible to register a probe provider with a name that has
already been registered. This is useful when wanting to load a new
version of a shared library on a already running process.

Changes are necessary in the lttng-session daemon to support cases where
the newly register event has a different probe payload.

Taking a simple case where a probe provider is registered twice, the
tracepoint call site will have two probes registered to it and thus will
generate two events in the trace.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: remove for() loop initial declarations
Mathieu Desnoyers [Tue, 6 Feb 2018 13:58:59 +0000 (08:58 -0500)] 
Fix: remove for() loop initial declarations

Breaks sles12sp2 builds:

08:51:35 lttng-ust-fd-tracker.c: In function 'dup_std_fd':
08:51:35 lttng-ust-fd-tracker.c:174:2: error: 'for' loop initial
declarations are only allowed in C99 mode
08:51:35   for (int i = 0; i < STDERR_FILENO + 1; i++) {
08:51:35   ^
08:51:35 lttng-ust-fd-tracker.c:174:2: note: use option -std=c99 or
-std=gnu99 to compile your code
08:51:35 lttng-ust-fd-tracker.c:195:11: error: redefinition of 'i'
08:51:35   for (int i = 0; i < fd_to_close_count; i++) {
08:51:35            ^
08:51:35 lttng-ust-fd-tracker.c:174:11: note: previous definition of 'i'
was here
08:51:35   for (int i = 0; i < STDERR_FILENO + 1; i++) {
08:51:35            ^
08:51:35 lttng-ust-fd-tracker.c:195:2: error: 'for' loop initial
declarations are only allowed in C99 mode
08:51:35   for (int i = 0; i < fd_to_close_count; i++) {
08:51:35   ^
08:51:35 Makefile:412: recipe for target 'lttng-ust-fd-tracker.lo'
failed
08:51:35 make[2]: *** [lttng-ust-fd-tracker.lo] Error 1
08:51:35 make[2]: *** Waiting for unfinished jobs....

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoUse ust_lock during sock_info operations for atomicity against fork
Jonathan Rajotte [Mon, 5 Feb 2018 22:58:19 +0000 (17:58 -0500)] 
Use ust_lock during sock_info operations for atomicity against fork

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoForce tracked fd to be bigger than STDERR_FILENO
Jonathan Rajotte [Mon, 5 Feb 2018 22:58:18 +0000 (17:58 -0500)] 
Force tracked fd to be bigger than STDERR_FILENO

This allow ust to be proactive regarding std* fd manipulation done by
external source.

A good example of this is the "daemon" function that can dup2 statically
the std* fd and close them silently if the were already used.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: numa: dynamically check that numa is available
Mathieu Desnoyers [Tue, 5 Dec 2017 16:55:07 +0000 (11:55 -0500)] 
Fix: numa: dynamically check that numa is available

Kernels with CONFIG_NUMA=n cause libnuma to print those messages:

"set_mempolicy: Function not implemented".

Check for numa availability before using it.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: specify SONAME in python-lttngust LoadLibrary
Michael Jeanson [Tue, 21 Nov 2017 16:11:15 +0000 (11:11 -0500)] 
Fix: specify SONAME in python-lttngust LoadLibrary

When loading the python agent library with ctypes in the python
bindings, specify the SONAME. This will make sure we load the proper
library in the event of a SONAME bump and the bindings will work without
having to install the "dev" package which in most distros contains the
non-versionned ".so".

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: ensure fd tracker is initialized when called from constructors
Mathieu Desnoyers [Sun, 12 Nov 2017 19:51:24 +0000 (14:51 -0500)] 
Fix: ensure fd tracker is initialized when called from constructors

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: fd of an elf object must be registered to the fd tracker
Jonathan Rajotte [Fri, 10 Nov 2017 16:06:41 +0000 (11:06 -0500)] 
Fix: fd of an elf object must be registered to the fd tracker

The open call take place inside ust, it must be tracked to prevent external
closing.

The bug can be hit during tracing of an application for which the probe
provider is loaded using LD_PRELOAD in combination with the fd utility
shared object. The application is responsible for closing all possible fd.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoCleanup: clock description for metadata was moved to lttng-sessiond
Jonathan Rajotte [Thu, 9 Nov 2017 22:37:14 +0000 (17:37 -0500)] 
Cleanup: clock description for metadata was moved to lttng-sessiond

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: liblttng-ust-fd.so: override fclose symbol
Mathieu Desnoyers [Tue, 7 Nov 2017 20:33:40 +0000 (15:33 -0500)] 
Fix: liblttng-ust-fd.so: override fclose symbol

fclose() invoked from application or libraries end up calling close()
from within the libc, which bypasses our file descriptor tracking.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoRevert "Use initial-exec TLS model"
Mathieu Desnoyers [Tue, 7 Nov 2017 14:38:18 +0000 (09:38 -0500)] 
Revert "Use initial-exec TLS model"

This reverts commit 553bbf7f38652084ed7966c7817b8ccb372b14e1.

The initial-exec model seems to behave differently than global-dynamic
with respect to lazy initialization, causing locks to be taken then
first time each thread touch the TLS. This introduces deadlocks with
library constructors waiting on other threads.

This will require further investigation.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoRevert "Fix: typo: DECLARE_URCU_TLS_IE -> DEFINE_URCU_TLS_IE"
Mathieu Desnoyers [Tue, 7 Nov 2017 14:37:46 +0000 (09:37 -0500)] 
Revert "Fix: typo: DECLARE_URCU_TLS_IE -> DEFINE_URCU_TLS_IE"

This reverts commit 364979886a80f7c993b3210af48a93f7d65f4530.

The initial-exec model seems to behave differently than global-dynamic
with respect to lazy initialization, causing locks to be taken then
first time each thread touch the TLS. This introduces deadlocks with
library constructors waiting on other threads.

This will require further investigation.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoconfigure.ac: add --disable-examples option to not build/install examples
Philippe Proulx [Mon, 6 Nov 2017 20:46:03 +0000 (15:46 -0500)] 
configure.ac: add --disable-examples option to not build/install examples

Some environments and distributions do not need the LTTng-UST examples
to be built because they remove them anyway. Continue to build them by
default, but add --disable-examples to explicitly disable them.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoDisable NUMA by default on 32bit arm
Michael Jeanson [Mon, 6 Nov 2017 19:09:30 +0000 (14:09 -0500)] 
Disable NUMA by default on 32bit arm

There is currently no NUMA support on 32bit arm, disable the dependency
on libnuma by default on this architecture. It can still be force with
--enable-numa.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoUpdate Makefile.am output about libnuma not found
Mathieu Desnoyers [Sun, 5 Nov 2017 14:08:03 +0000 (09:08 -0500)] 
Update Makefile.am output about libnuma not found

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoUpdate readme to document opt dep on numa
Mathieu Desnoyers [Sun, 5 Nov 2017 14:02:12 +0000 (09:02 -0500)] 
Update readme to document opt dep on numa

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agonuma support: allow disabling numa support
Mathieu Desnoyers [Sun, 5 Nov 2017 14:01:04 +0000 (09:01 -0500)] 
numa support: allow disabling numa support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoUpdate README to document dependency on libnuma
Mathieu Desnoyers [Sun, 5 Nov 2017 13:30:08 +0000 (08:30 -0500)] 
Update README to document dependency on libnuma

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoTake NUMA configuration into account for UST buffer allocation
Mathieu Desnoyers [Sun, 5 Nov 2017 12:45:02 +0000 (07:45 -0500)] 
Take NUMA configuration into account for UST buffer allocation

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: typo: DECLARE_URCU_TLS_IE -> DEFINE_URCU_TLS_IE
Mathieu Desnoyers [Sat, 21 Oct 2017 10:45:42 +0000 (12:45 +0200)] 
Fix: typo: DECLARE_URCU_TLS_IE -> DEFINE_URCU_TLS_IE

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoUse initial-exec TLS model
Mathieu Desnoyers [Thu, 19 Oct 2017 13:27:27 +0000 (09:27 -0400)] 
Use initial-exec TLS model

Use initial-exec TLS model for TLS variables. Those are faster, and
signal-handler-safe.

Link: https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter8-20.html
Link: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#Common-Variable-Attributes
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agolttng-gen-tp: formatting
Jonathan Rajotte [Tue, 19 Sep 2017 16:08:34 +0000 (12:08 -0400)] 
lttng-gen-tp: formatting

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: lttng-gen-tp: only replace file extension
Jonathan Rajotte [Tue, 19 Sep 2017 16:08:33 +0000 (12:08 -0400)] 
Fix: lttng-gen-tp: only replace file extension

Previous replace was done on the complete path. A path containing
.c or .o would result in a corrupted file path.

Reported-by: Gunnar Strand <Gunnar.Strand@ericsson.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: move fsync after ftruncate
Mathieu Desnoyers [Wed, 23 Aug 2017 15:27:16 +0000 (08:27 -0700)] 
Fix: move fsync after ftruncate

Move fsync after ftruncate to ensure we sync up all metadata after the
entire initialization of the buffer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: sync buffer file metadata on buffer allocation
Mathieu Desnoyers [Wed, 23 Aug 2017 15:17:48 +0000 (08:17 -0700)] 
Fix: sync buffer file metadata on buffer allocation

Synchronizing the file metadata on disk after zeroing the whole file (on
buffer allocation) will make the crash extraction feature (--shm-path
create option) more robust. It ensures the content of the file metadata
backing the buffers does not have to be updated while tracing into the
memory map. Therefore, the on-disk metadata will never be out of sync at
the point where a system crash occurs.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agolttng-ust(3): reword and fix style of `LTTNG_UST_ALLOW_BLOCKING` variable
Philippe Proulx [Fri, 28 Jul 2017 19:30:09 +0000 (15:30 -0400)] 
lttng-ust(3): reword and fix style of `LTTNG_UST_ALLOW_BLOCKING` variable

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agolttng-ust(3): specify "If set" instead of "if set to 1" for some variables
Philippe Proulx [Fri, 28 Jul 2017 19:25:07 +0000 (15:25 -0400)] 
lttng-ust(3): specify "If set" instead of "if set to 1" for some variables

The actual library's behaviour is to check if the environment variable
is set, not only if it's set to the string `1`.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: doc/man: use a single XSL file and match local names
Philippe Proulx [Thu, 27 Jul 2017 23:28:40 +0000 (19:28 -0400)] 
Fix: doc/man: use a single XSL file and match local names

Matching the local name instead of the full name, that is:

    *[local-name() = 'co']

instead of just `co` matches both the non-namespaced element and the
DocBook-namespaced element whether we're using the DocBook 4.5 or
DocBook 5.0 stylesheets.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: Expand the shmobj size for the sequence number
Liguang Li [Thu, 22 Jun 2017 08:56:29 +0000 (16:56 +0800)] 
Fix: Expand the shmobj size for the sequence number

This patch fixes a bug which was introduced by:
1ff31389b ("Generate and export the sequence number")

Signed-off-by: Liguang Li <liguang.li@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoIntroduce LTTNG_UST_ALLOW_BLOCKING env. var.
Mathieu Desnoyers [Fri, 26 May 2017 15:59:54 +0000 (17:59 +0200)] 
Introduce LTTNG_UST_ALLOW_BLOCKING env. var.

Introduce the LTTNG_UST_ALLOW_BLOCKING env. var. to control whether
applications are allowed to block when a buffer is full. If set, it
allows the tracer to block the application when buffers are full.

The blocking is now controlled by a per-channel configuration option in
the LTTng control interface for channels with the "--blocking-timeout"
parameter, which is specified in usec (or -1 to block forever).

This replaces the LTTNG_UST_BLOCKING_RETRY_TIMEOUT env. var., which
actually never made it into a stable release (we therefore remove this
env. var).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: lttng-ust-elf.c: define NT_GNU_BUILD_ID if not defined
Philippe Proulx [Sat, 29 Oct 2016 17:32:57 +0000 (13:32 -0400)] 
Fix: lttng-ust-elf.c: define NT_GNU_BUILD_ID if not defined

On uClibc, NT_GNU_BUILD_ID is not defined, so we define it
manually in this case.

This definition is the number given to the .note.gnu.build-id section
(of type SHT_NOTE) of a linked ELF object.

    The ELF note headers give name "GNU" and type 3 (NT_GNU_BUILD_ID)
for a build ID note, of which there can be only one in a linked object
[...]

See http://fedoraproject.org/wiki/RolandMcGrath/BuildID

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoCalculate context length outside of retry loop
Mathieu Desnoyers [Sat, 27 May 2017 13:14:41 +0000 (15:14 +0200)] 
Calculate context length outside of retry loop

Allow context length calculation to have side-effects which trigger
event tracing by moving the calculation outside of the buffer space
reservation retry loop.

This also paves the way to have dynamically sized contexts in lttng-ust,
which would expect to put their size of the internal stack. Note that
the context length calculation is performed *after* the event payload
field length calculation, so the stack needs to be used accordingly.

Currently, the only dynamically sized contexts we have are provided by
Java integration, which keeps its own stack.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: Quote CMAKE variable assignment in Makefile
Michael Jeanson [Tue, 9 May 2017 20:55:44 +0000 (16:55 -0400)] 
Fix: Quote CMAKE variable assignment in Makefile

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoRework configure script
Michael Jeanson [Tue, 9 May 2017 20:10:46 +0000 (16:10 -0400)] 
Rework configure script

 * Harmonize with our other projects
 * Add missing checks
 * Fix help strings indentation
 * Fix SED tool detection
 * Add mini-report

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: Typo in doc/examples/Makefile.am
Michael Jeanson [Tue, 9 May 2017 19:24:40 +0000 (15:24 -0400)] 
Fix: Typo in doc/examples/Makefile.am

$(CPPLAGS) -> $(CPPFLAGS)

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: Don't override user variables within the build system
Michael Jeanson [Tue, 9 May 2017 18:25:01 +0000 (14:25 -0400)] 
Fix: Don't override user variables within the build system

Instead use the appropriatly prefixed AM_* variables as to not interfere
when a user variable is passed to a make command. The proper use of flag
variables is documented at :

https://www.gnu.org/software/automake/manual/automake.html#Flag-Variables-Ordering

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoMove m4 scripts to m4 dir
Michael Jeanson [Tue, 9 May 2017 18:46:38 +0000 (14:46 -0400)] 
Move m4 scripts to m4 dir

Harmonize build system configuration across our projects.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agodoc: remove duplicate LTTNG_UST_BLOCKING_RETRY_TIMEOUT man page entry
Mathieu Desnoyers [Sat, 6 May 2017 02:26:31 +0000 (22:26 -0400)] 
doc: remove duplicate LTTNG_UST_BLOCKING_RETRY_TIMEOUT man page entry

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoVersion 2.10.0-rc1
Mathieu Desnoyers [Sat, 6 May 2017 01:04:54 +0000 (21:04 -0400)] 
Version 2.10.0-rc1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoClean-up: remove unused variables to silence gcc warning
Jérémie Galarneau [Fri, 5 May 2017 15:52:07 +0000 (11:52 -0400)] 
Clean-up: remove unused variables to silence gcc warning

GCC 6.3.1 warns that two variables (write_offset and consumed_cur)
in lib_ring_buffer_snapshot_sample_positions() are unused.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoAdd ustctl_snapshot_sample_positions ustctl command
Jérémie Galarneau [Fri, 5 May 2017 14:33:06 +0000 (10:33 -0400)] 
Add ustctl_snapshot_sample_positions ustctl command

The protocol's minor version is bumped since a new API entry
point is introduced. The so name's "current" and "age" fields are
bumped in accordance with the libtool guidelines[1].

[1] https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoCleanup: formatting in strutils_star_glob_match explanation
Francis Deslauriers [Fri, 17 Mar 2017 20:55:21 +0000 (16:55 -0400)] 
Cleanup: formatting in strutils_star_glob_match explanation

Replace tabs for spaces in example scenario.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.044031 seconds and 5 git commands to generate.