lttng-ust.git
3 years agofix: size_t is unsigned, can't be negative
Michael Jeanson [Wed, 24 Mar 2021 23:09:41 +0000 (19:09 -0400)] 
fix: size_t is unsigned, can't be negative

Change-Id: Id4e2c5b3c984978d26b6224794c0073b5c6eaf8a
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoImport libtap from babeltrace
Michael Jeanson [Wed, 24 Mar 2021 20:41:29 +0000 (16:41 -0400)] 
Import libtap from babeltrace

Import the fixes to our local copy of libtap from the babeltrace
repository. This will allow enabling stricter compiler warnings down the
line.

Change-Id: I639b317c5f1c22b48e223b8e5649cf727a1f25c3
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd unit tests for utils macros
Michael Jeanson [Thu, 25 Mar 2021 15:01:17 +0000 (11:01 -0400)] 
Add unit tests for utils macros

Change-Id: I1908e7031f8b4493813f7a5fe6ac1ab90d062afc
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd a C++ version of lttng_ust_is_signed_type
Michael Jeanson [Thu, 25 Mar 2021 16:03:12 +0000 (12:03 -0400)] 
Add a C++ version of lttng_ust_is_signed_type

Change-Id: Iee3da5491bb00fb5144ecf631a122969396d1b40
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: int8_t is not considered an integer
Michael Jeanson [Thu, 25 Mar 2021 17:07:21 +0000 (13:07 -0400)] 
fix: int8_t is not considered an integer

Add 'signed char' to the list of types we consider integers. Since 'char'
being signed or unsigned is implementation dependant, we have to
explicitly list 'char', 'signed char' and 'unsigned char' as integer
types.

Change-Id: I3aace2621f14f54e5d88d43de509a6cffde66c5b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd unit tests for lttng_ust_strerror
Michael Jeanson [Thu, 25 Mar 2021 17:21:18 +0000 (13:21 -0400)] 
Add unit tests for lttng_ust_strerror

Change-Id: I0c85780835b41a1ace9e91f0edc104bfd272f51f
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoRe-implement lttng_ust_strerr
Michael Jeanson [Thu, 25 Mar 2021 17:19:34 +0000 (13:19 -0400)] 
Re-implement lttng_ust_strerr

Re-implement lttng_ust_strerr based on the tools internal
implementation.

 * Require a negative error code from enum lttng_ust_error_code or zero
 * Don't handle negative error codes as system errors anymore

Change-Id: I89a95f4f6b0c392c8fa7bdb3ad40a8d6ea918acf
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoNamespace 'lttng_alignof' to 'lttng_ust_rb_alignof'
Michael Jeanson [Fri, 26 Mar 2021 17:20:51 +0000 (13:20 -0400)] 
Namespace 'lttng_alignof' to 'lttng_ust_rb_alignof'

Add the standard prefix and make it clearer this is a macro specific to
the ring buffer and not a generic wrapper over alignof.

Change-Id: If929f9744a98ea6980f4239456a59630bd1fc8e9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoNamespace remaining symbols in lttng/ringbuffer-context.h
Michael Jeanson [Wed, 24 Mar 2021 16:04:21 +0000 (12:04 -0400)] 
Namespace remaining symbols in lttng/ringbuffer-context.h

The major SONAME bump to '1' gives us the opportunity to properly
namespace some older parts of the API.

Change-Id: I0393d22738f8b98ac5ed73455aaaa0b84db0297d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoPython agent lib soname major bump
Michael Jeanson [Wed, 3 Mar 2021 17:10:20 +0000 (12:10 -0500)] 
Python agent lib soname major bump

Make the python agent library follow the main library soname for
co-installability with previous versions. Also use the value provided by
the build system instead of manually synchronizing it.

Change-Id: Ieef9b9ca6dcfd08b7834e5faafef3935a6a1a232
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoIntroduce SONAME defines
Michael Jeanson [Thu, 18 Mar 2021 20:50:27 +0000 (16:50 -0400)] 
Introduce SONAME defines

Folowing the refactor of the autotools code, the major soname number of each
library is now available as a define in 'lttng/ust-version.h'. Use them
instead of literal value that have to be synchronized manually.

Change-Id: I7d777d32c2a710708c1ac2546111458c281fce13
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoNamespace ust-fork symbols
Michael Jeanson [Tue, 23 Mar 2021 21:23:53 +0000 (17:23 -0400)] 
Namespace ust-fork symbols

Namespace the public symbols used by liblttng-ust-fork and move them a
more appropriatly named header.

The major SONAME bump to '1' gives us the opportunity to properly
namespace some older parts of the API.

Change-Id: Ic44998cbf77c3ae8cd7e73c9ad789d743cefdd05
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoNamespace RING_BUFFER_ALIGN macros
Michael Jeanson [Tue, 23 Mar 2021 20:56:21 +0000 (16:56 -0400)] 
Namespace RING_BUFFER_ALIGN macros

Also add comments to clarify why efficient memory access impacts the
layout of the ringbuffer.

Change-Id: I752f8b6dec6b00b8222500194cd53428db7d0da5
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agocleanup: Remove redefinition of CHAR_BIT
Michael Jeanson [Tue, 23 Mar 2021 20:31:22 +0000 (16:31 -0400)] 
cleanup: Remove redefinition of CHAR_BIT

Remove the redefinition of CHAR_BIT in 'lttng/ust-tracer.h', it is
defined in 'limits.h' by all major Linux libc and even other Unices.

Explicitly include <limits.h> in all files using CHAR_BIT.

Change-Id: I917f6ee16898a6f99fa32db5d6ebd701e95400cc
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agocleanup: Namespace public utils macros
Michael Jeanson [Tue, 23 Mar 2021 15:17:53 +0000 (11:17 -0400)] 
cleanup: Namespace public utils macros

Namespace utils macros in public headers under the 'lttng_ust_' prefix
and regroup them in single header file.

Change-Id: I65f133b25c54f8ef59070c9b56c79fbaf5ca84d2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agotracepoint probe refactoring: Move provider name to provider descriptor
Mathieu Desnoyers [Fri, 26 Mar 2021 15:13:25 +0000 (11:13 -0400)] 
tracepoint probe refactoring: Move provider name to provider descriptor

The provider name is currently repeated for each event name as:

  <provider name>:<event name>

This repetition requires that each event embeds the provider name within
its own name.

Use this ABI break to clean this up: instead, each event descriptor has
a pointer to its probe descriptor, and each probe descriptor has a
provider name.

Implement name size validation and event name formatting internal
helpers, and use them across the tracer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ief8a4696a2030bf3b9c785b8422f382079c6bf06

3 years agoRefactoring: remove ring buffer channel pointer from struct lttng_ust_channel_buffer
Mathieu Desnoyers [Mon, 29 Mar 2021 15:42:44 +0000 (11:42 -0400)] 
Refactoring: remove ring buffer channel pointer from struct lttng_ust_channel_buffer

This pointer can be moved to an internal data structure, and be
populated by the ring buffer client rather than the probes.

Also transition all ring buffer client callbacks to use buffer and
channel structures rather than shm handle.

Also remove the handle from struct ustctl_consumer_stream (internal to
ustctl.c) because it is redundant.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9c389626de5a02cf2ac7377d9f1e2802128992c4

3 years agoAPI cleanup: Remove handle from struct lttng_ust_channel_buffer
Mathieu Desnoyers [Fri, 26 Mar 2021 20:30:21 +0000 (16:30 -0400)] 
API cleanup: Remove handle from struct lttng_ust_channel_buffer

Now that the handle is fetched from struct lttng_ust_lib_ring_buffer_channel
by the ring buffer client callbacks, there is no need to keep it around
in the public API struct lttng_ust_channel_buffer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id41d1ffb171ea64150e2ceebd51c9679071ee337

3 years agoRemove handle field from ring buffer context
Mathieu Desnoyers [Fri, 26 Mar 2021 20:25:41 +0000 (16:25 -0400)] 
Remove handle field from ring buffer context

The ring buffer handle is available in the struct lttng_ust_lib_ring_buffer_channel,
therefore passing it through the ring buffer context is redundant.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7baca38b86743ba88a55b9d336135df2256756d1

3 years agoring buffer context: cpu number becomes an output of reserve
Mathieu Desnoyers [Fri, 26 Mar 2021 17:52:25 +0000 (13:52 -0400)] 
ring buffer context: cpu number becomes an output of reserve

In order to facilitate eventual integration of a ring buffer scheme
based on Restartable Sequences (sys_rseq), change the ownership of the
ring buffer context "cpu" field so it is now populated by the ring
buffer reserve operation. This means a rseq-based reserve could retry
on a new current cpu after a rseq-cmpxchg fails to reserve and then a
migration occurs.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If0c0689446975085b5e22b14aef6a15f12f8ff9f

3 years agoFix: truncation of text array and sequences by NULL terminator
Mathieu Desnoyers [Thu, 25 Mar 2021 18:47:47 +0000 (14:47 -0400)] 
Fix: truncation of text array and sequences by NULL terminator

The recent refactor does not take into account that text array and text
sequence types behave like Pascal Strings and not C strings, which means
the NULL terminator is optional, and the string size is delimited by the
array or sequence length.

Introduce a new lib_ring_buffer_pstrcpy() to handle copying into a ring
buffer Pascal String, and use it for array and sequence of text.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fixes: 2792781482a5 ("ABI refactoring: sequence and array of text: copy input as string")
Fixes: #1301
Change-Id: Idcc13f061d5229496476f42dce84c2f395b7f6e6

3 years agoCleanup: use "char" type for padding
Mathieu Desnoyers [Thu, 25 Mar 2021 19:57:05 +0000 (15:57 -0400)] 
Cleanup: use "char" type for padding

The ring buffer strcpy operation can take a "char" rather than "int" as
parameter, which is a closer match to its actual expected type.

Same goes for the do memset internal operation.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3c043ecff46cfef48c8992d004154383f7cab59d

3 years agocompiler warning cleanup: is_signed_type: compare -1 to 1
Mathieu Desnoyers [Thu, 25 Mar 2021 18:28:20 +0000 (14:28 -0400)] 
compiler warning cleanup: is_signed_type: compare -1 to 1

Comparing -1 to 0 triggers compiler warnings (gcc -Wtype-limits and
-Wbool-compare) and Coverity warning "Macro compares unsigned to 0".

Comparing -1 to 1 instead takes care of silencing those warnings while
keeping the same behavior.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5003ce1f80d34ca6713bab43e8114a23f2d8c1d4

3 years agoRename struct lttng_ust_channel_ops to struct lttng_ust_channel_buffer_ops
Mathieu Desnoyers [Tue, 23 Mar 2021 19:53:39 +0000 (15:53 -0400)] 
Rename struct lttng_ust_channel_ops to struct lttng_ust_channel_buffer_ops

Likewise for private structure. This namespacing will allow smoother
integration of upcoming counter feature in the public API.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Idc68f43febbb7e6ad2ed02615ddaee6a3e729b09

3 years agofix: Group Targets requires GNU Make >= 4.3
Michael Jeanson [Tue, 23 Mar 2021 18:20:21 +0000 (14:20 -0400)] 
fix: Group Targets requires GNU Make >= 4.3

Group Targets requires GNU Make >= 4.3 released in 2020, with older Make
release the syntax only results in a warning and most of the time it
will work fine since the rule is called and generates both files.
However it breaks the dependencies across files and makes the man pages
generation racy.

Use a less elegant workaround that is compatible with all Make
implementations.

Change-Id: I46a0488c6ff61082f641d8ee55ad2802c0bfa046
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoclock override: introduce getter API for lttng tools
Mathieu Desnoyers [Tue, 23 Mar 2021 15:58:52 +0000 (11:58 -0400)] 
clock override: introduce getter API for lttng tools

Currently, the lttng session daemon reimplements its own copy of
struct lttng_trace_clock, which is pretty bad as ABI go.

Implement getter functions for each of the clock callback instead. This
refactoring needs to be introduced with a matching commit to use the new
ABI in LTTng tools.

Move the implementation of the clock frequency, uuid, name and
description default callbacks (for monotonic clock) to lttng-ust.

This allow to hide the previously exposed "lttng_trace_clock" public
symbol. Rename this internal symbol to lttng_ust_trace_clock for prefix
consistency. Rename struct lttng_trace_clock to struct
lttng_ust_trace_clock for similar reasons.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I55825f0c0f5372a68aaaf06fb8dbd256cf248f2c

3 years agoust-abi: add missing lttng_ust_abi prefixes
Mathieu Desnoyers [Tue, 23 Mar 2021 18:59:47 +0000 (14:59 -0400)] 
ust-abi: add missing lttng_ust_abi prefixes

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie2b2c28643203ba3a19b746241997776b8c58ed5

3 years agofix: java detection is optional
Michael Jeanson [Tue, 23 Mar 2021 16:54:41 +0000 (12:54 -0400)] 
fix: java detection is optional

I misunderstood the dependencies between the different java macros, move
the binairies detection back to optionnal for the time being.

Change-Id: I917f8f5dc7c34f1ac360d405b3a2327e2ee518e7
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: use configured python when building the examples
Michael Jeanson [Tue, 23 Mar 2021 16:09:49 +0000 (12:09 -0400)] 
fix: use configured python when building the examples

Prior to the refactoring of the autotools setup we used different python
detection mechanisms for the python agent feature and the example code.
The example code detection was flawed as it would only work with a
python binary named exactly 'python'. Wire the detected python binary in
the examples Makefile integration.

Change-Id: I07b9222a8869ff154073e5b72fb2ac0d70f14896
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoABI refactoring: sequence and array of text: copy input as string
Mathieu Desnoyers [Mon, 22 Mar 2021 20:59:38 +0000 (16:59 -0400)] 
ABI refactoring: sequence and array of text: copy input as string

Within the lttng-modules writeback instrumentation, which exposes a
tracepoint probe API similar to LTTng-UST, we had a long standing issue
where a fixed-size array of text was used to copy a string input into
the trace.

This is fine as long as the input string is actually backed by a
fixed-size array, but if the input string is variable-size, and may be
smaller than the array size, this led to out-of-bound memory reads
beyond the input string NULL terminating character.

Change the behavior of the array/sequence of text to stop copying the
input as soon as the array/sequence size limit (-1) or the input's NULL
terminating character is found, and add zeroed padding for the rest of
the array/sequence within the ring buffer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icc3f31c12bdd8018e5e4b7ea146fe842371054d6

3 years agocleanup: don't copy lttng-gen-tp in OOT builds
Michael Jeanson [Tue, 23 Mar 2021 14:20:09 +0000 (10:20 -0400)] 
cleanup: don't copy lttng-gen-tp in OOT builds

No need to make a copy of lttng-gen-tp when doing an out of tree build,
just use the path to the source dir in the examples Makefile.

Change-Id: I485d0f9b25232d0ce46c2f7981a3ef781155c749
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoconfigure: convert the remaining tab indent to spaces
Michael Jeanson [Mon, 22 Mar 2021 19:09:55 +0000 (15:09 -0400)] 
configure: convert the remaining tab indent to spaces

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: I452eb6ffad31ee0951f7eb2e44861dcfc49cae77
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoconfigure: regroup autoconf substituted variable
Michael Jeanson [Mon, 22 Mar 2021 18:59:31 +0000 (14:59 -0400)] 
configure: regroup autoconf substituted variable

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: If2938c615477604693787ea69c956a37931cef13
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoconfigure: regroup automake conditionals
Michael Jeanson [Mon, 22 Mar 2021 18:40:41 +0000 (14:40 -0400)] 
configure: regroup automake conditionals

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: I3b7f8f15ac6f8752aa2d7eb9a62e45cf4ac354f9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoconfigure: regroup C defines
Michael Jeanson [Mon, 22 Mar 2021 18:34:47 +0000 (14:34 -0400)] 
configure: regroup C defines

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: I1aa80c098f0c36640eff3113db3544bd303a815c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoIntroduce AE_FEATURE to manage configure features
Michael Jeanson [Mon, 22 Mar 2021 17:29:58 +0000 (13:29 -0400)] 
Introduce AE_FEATURE to manage configure features

The new AE_FEATURE set of macros are wrappers over autoconf's
AC_ARG_ENABLE. The main objective is to make the m4sh code more readable
to the less seasoned autotools enthusiast among us and reduce the
duplication of code with its associated bugs.

The AE prefix was chosen to mean "Autotools EfficiOS" and is part of an
effort to standardize our custom macros across all our autotools based
projects.

Change-Id: I35268e36e70b2dd826876939e663d63d3123fa9f
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoconfigure: regroup os and arch specific defaults
Michael Jeanson [Mon, 22 Mar 2021 17:17:32 +0000 (13:17 -0400)] 
configure: regroup os and arch specific defaults

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: Ib0f3319133ed7dfab8ee844f6bcf99dd9606d344
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoconfigure: regroup library checks
Michael Jeanson [Mon, 22 Mar 2021 17:12:42 +0000 (13:12 -0400)] 
configure: regroup library checks

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: Ieec98a3ab09c2088408b0f0bbd9bc3b605077982
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoconfigure: regroup program checks
Michael Jeanson [Mon, 22 Mar 2021 17:06:28 +0000 (13:06 -0400)] 
configure: regroup program checks

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: I32c54c43a82c4b3f532b702bd733a54683167082
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoconfigure: regroup C header checks
Michael Jeanson [Mon, 22 Mar 2021 16:57:44 +0000 (12:57 -0400)] 
configure: regroup C header checks

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: I659c98ce9eb328e78d1c075a1157f59848195650
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoconfigure: regroup and expand C compiler checks
Michael Jeanson [Mon, 22 Mar 2021 16:44:54 +0000 (12:44 -0400)] 
configure: regroup and expand C compiler checks

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: I304f4bda39e60321248772ef9864cd205a049a6f
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoconfigure: Introduce macro ae_in_git_repo
Michael Jeanson [Mon, 22 Mar 2021 18:44:35 +0000 (14:44 -0400)] 
configure: Introduce macro ae_in_git_repo

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: Ifffade15ac4a15823be8ab1b6c8232624a89ab7c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoconfigure: centralize version information
Michael Jeanson [Mon, 22 Mar 2021 16:24:34 +0000 (12:24 -0400)] 
configure: centralize version information

Centralise version information at the beginning of configure.ac to
improve readability.

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: Ia4de4737ac73e7dac55341e7b238780501289350
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoUse a single macro to configure CXX
Michael Jeanson [Thu, 18 Mar 2021 20:37:40 +0000 (16:37 -0400)] 
Use a single macro to configure CXX

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: I3667b0e61d44fd2e2ff36ac6935888e6a895ce73
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: use the configured cmake binary
Michael Jeanson [Thu, 18 Mar 2021 20:25:34 +0000 (16:25 -0400)] 
fix: use the configured cmake binary

Use the configure cmake binary in the examples Makefile instead of a
direct call.

Change-Id: Idb66642345e551b427e359b9cd58f49aad2a8502
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoconfigure: standardize automake conditional names
Michael Jeanson [Thu, 18 Mar 2021 20:08:48 +0000 (16:08 -0400)] 
configure: standardize automake conditional names

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: I32fe475e04e77b2972ed9d963f1d2a5c6440a4ce
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoCentralize arch detection in a public header
Michael Jeanson [Thu, 18 Mar 2021 18:16:40 +0000 (14:16 -0400)] 
Centralize arch detection in a public header

Add a public header with centralized compiler arch detection and arch
specific parameters. Namespace everything under 'LTTNG_UST_ARCH_'.

Move "LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS" from a configure time
define to a static one base on compiler arch detection.

This will simplify the build system and remove the possibility of
accidently mixing aligned and unaligned access in a multiarch
environment with shared header files.

Change-Id: Ic977d13f031ad070bea4ff5d7b2b8079843e0c26
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoSet the default ust constructor timeout in the headers
Michael Jeanson [Thu, 18 Mar 2021 18:00:34 +0000 (14:00 -0400)] 
Set the default ust constructor timeout in the headers

This is not user-configurable, use the same strategy as all other
internal defaults.

Change-Id: I05d61999afee44687336bf70712ee99e2da19f71
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: don't override the project wide AM_CPPFLAGS
Michael Jeanson [Thu, 18 Mar 2021 17:57:13 +0000 (13:57 -0400)] 
fix: don't override the project wide AM_CPPFLAGS

Fix some makefiles imported after we switched to a global standardized
include path in AM_CPPFLAGS.

Change-Id: Ibb02293f86848b968c4fe190b137e562f94e83b4
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd basic shell tests script framework
Michael Jeanson [Thu, 18 Mar 2021 17:49:55 +0000 (13:49 -0400)] 
Add basic shell tests script framework

Import a stripped down shell tests script framework from babeltrace2.

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: I41ea4b186fe744fd6841d866daa87a802c96b692
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoSimplify python agent build
Michael Jeanson [Thu, 18 Mar 2021 17:45:06 +0000 (13:45 -0400)] 
Simplify python agent build

Import the fixes and simplification to the python build integration with
autotools from babeltrace2.

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: I1da953c48acc2162f369893793e195803376a4f8
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoport: update pthread get/set name compat
Michael Jeanson [Wed, 16 Dec 2020 17:39:46 +0000 (12:39 -0500)] 
port: update pthread get/set name compat

Sync the pthread set/get name compat with tools, to add support for
recent FreeBSD and MacOS API.

Change-Id: I9c16fc32e2a75e3f484198279e1660f3e2c5e142
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: bytecode linker: validate event and field array/sequence encoding
Mathieu Desnoyers [Mon, 22 Mar 2021 16:52:54 +0000 (12:52 -0400)] 
Fix: bytecode linker: validate event and field array/sequence encoding

The bytecode linker should only allow linking filter expressions loading
fields which are string-encoded arrays and sequence for comparison
against a string, and reject arrays and sequences without encoding, so
the filter interpreter does not attempt to load non-NULL terminated
arrays/sequences as if they were strings.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7e0d42dc53738f36af372b4352c44bc1fff916d1

3 years agoValidate match of all session channel's UUID
Mathieu Desnoyers [Mon, 22 Mar 2021 14:01:55 +0000 (10:01 -0400)] 
Validate match of all session channel's UUID

Add a validation at channel creation to ensure that the uuid of all
channels created within a session match.

Note that we still need to keep a copy of the uuid field in the channel
private data at this stage, because the consumer daemon creates channels
with a NULL session pointer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3490bab8879ffa66bc1e19559b0a1a60d33d605b

3 years agoCleanup: Remove whiteline
Mathieu Desnoyers [Mon, 22 Mar 2021 13:50:19 +0000 (09:50 -0400)] 
Cleanup: Remove whiteline

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I128bcc42913028f28035794519900d688373544f

3 years agoCleanup: align private header comments
Mathieu Desnoyers [Mon, 22 Mar 2021 13:47:30 +0000 (09:47 -0400)] 
Cleanup: align private header comments

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I358a424e765a150c395fc3efa1b61e3f2020a2c5

3 years agoCleanup: remove old comments
Mathieu Desnoyers [Mon, 22 Mar 2021 13:45:21 +0000 (09:45 -0400)] 
Cleanup: remove old comments

Those comments are not useful for internal structures.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5341e686e20f164333166b008dd9d446c3e6dea3

3 years agoRefactoring and fix: bytecode ABI
Mathieu Desnoyers [Fri, 19 Mar 2021 04:03:17 +0000 (00:03 -0400)] 
Refactoring and fix: bytecode ABI

Introduce an "event filter" callback to be called by the instrumentation
probe, and move the bytecode list into private data structures.

This will allow much more freedom in choosing how bytecodes are combined
both in terms of logic (OR vs AND) and implementation (jits).

Currently, we keep callbacks internally as well for each bytecode
evaluation, but nothing prevents to change how this works in the future
to improve performance now that this is all private.

For filters, we add the following fields to struct lttng_ust_event_common:

       int eval_filter;                                /* Need to evaluate filters */
       int (*run_filter)(struct lttng_ust_event_common *event,
               const char *stack_data,
               void *filter_ctx);

"eval_filter" is a state indicating whether the filter should be
evaluated at all. It combines internal knowledge of whether the filter
bytecode list is empty, and whether there are enablers without filter
bytecode attached to the event.

For captures, a new struct lttng_ust_notification_ctx is introduced,
which is to be used as additional "context" to the notification_send()
callback. This allows passing the "eval_capture" state from the probe
to the notification callback, and fixes a bug where a sequence of:

- create notification enabler,
- enable notification enabler,
- add capture to enabler,

where a tracepoint runs concurrently with add capture happens to do a
first capture list_empty check which skips the stack preparation,
whereas the second capture list_empty check within the notification
callback finds a capture entry, and thus attempts to use an
uninitialized stack. The notification callback is also modified to use
an RCU-aware list traversal.

For captures, the following field is added to struct lttng_ust_event_notifier:

       int eval_capture;                               /* Need to evaluate capture */

which is to be read once by the probe and its state saved and used
thorough the entire probe execution.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iae70c5e7924f14b38e14676368cf2516951218ee

3 years agoBytecode: update documentation
Mathieu Desnoyers [Fri, 19 Mar 2021 03:22:18 +0000 (23:22 -0400)] 
Bytecode: update documentation

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I687ad8f08c735704ce1084c21d9c782deadd2541

3 years agoRefactoring: bytecode interpreter ABI
Mathieu Desnoyers [Thu, 18 Mar 2021 21:04:07 +0000 (17:04 -0400)] 
Refactoring: bytecode interpreter ABI

Refactor the ABI of the bytecode interpreter, which is used by the probe
provider callbacks:

- Return a "int" rather than uint64_t,
- The return values are now:
       LTTNG_UST_BYTECODE_INTERPRETER_ERROR = -1,
       LTTNG_UST_BYTECODE_INTERPRETER_OK = 0,
- Introduce a bytecode "context". This context is specific for each
  bytecode "class" (filter or capture). The filter class context
  has a "result" (accept/reject) output, whereas the capture class
  has an "output".
- The bytecode context is extensible with the struct_size scheme.
- Merge filter and capture interpreters into a single callback.
  That callback uses a new "bytecode type" field within the bytecode
  private data to figure out the specific bytecode class (filter or
  capture).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id528e141d0c213e9bb41f68d6d7e632104daa1cf

3 years agoFix: java agent: migrate to new channel structures
Mathieu Desnoyers [Thu, 18 Mar 2021 20:08:10 +0000 (16:08 -0400)] 
Fix: java agent: migrate to new channel structures

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic20da8461a6d8fe741b701b7b9e68a3aeb2ad7a1

3 years agoMove event context to private structures
Mathieu Desnoyers [Thu, 18 Mar 2021 19:57:06 +0000 (15:57 -0400)] 
Move event context to private structures

The list of contexts active for an event can be moved to a private
structure by keeping the temporary pointer to the RCU dereferenced
context in the ring buffer client's internal context rather than within
the context shared between the probe and the ring buffer client.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3040edf42ea59786a4ee1b5b3f9a90e1834821ab

3 years agoMove channel context to private structures
Mathieu Desnoyers [Thu, 18 Mar 2021 19:49:11 +0000 (15:49 -0400)] 
Move channel context to private structures

The list of contexts active for a channel can be moved to a private
structure by keeping the temporary pointer to the RCU dereferenced
context in the ring buffer client's internal context rather than within
the context shared between the probe and the ring buffer client.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iaf9491255d1a0940450dea613ac6e5bc0705506d

3 years agoRefactoring: Channel structures
Mathieu Desnoyers [Thu, 18 Mar 2021 15:44:30 +0000 (11:44 -0400)] 
Refactoring: Channel structures

Now that struct lttng_channel is separate from the consumer daemon
channel config message ABI layout, we can perform a significant amount
of refactoring:

- Namespace theses structures with lttng_ust_ prefix,
- Use struct_size extensibility scheme.
- Split fields into public/private structures,
- Split public and private structures into a child (ring buffer)
  and parent (common). This will allow introducing other channel
  children types in the future (e.g. counters).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6acec4e4ffff721e6ea5698e64a063045e1c1022

3 years agostruct lttng_channel: split protocol ABI from instrumentation ABI
Mathieu Desnoyers [Thu, 18 Mar 2021 13:34:55 +0000 (09:34 -0400)] 
struct lttng_channel: split protocol ABI from instrumentation ABI

Duplicate struct lttng_channel to introduce a new struct
lttng_ust_abi_channel_config meant to hold configuration data within the
memory area belonging to the ring buffer private data. Now the
application and consumer private pointer will be a separate pointer,
for which the memory will be owned by the caller.

This will allow us to modify the layout of struct lttng_channel without
breaking the UST communication protocol.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I96684aa6658f59dc3332da6034bdf9e3f921261f

3 years agoRemove the LTTNG_PACKED macro
Michael Jeanson [Wed, 17 Mar 2021 20:31:53 +0000 (16:31 -0400)] 
Remove the LTTNG_PACKED macro

We already use __attribute__((packed)) directly in some public headers.
Remove the LTTNG_PACKED macro and replace it with the literal attribute.

The LTTNG_PACKED macro was meant to support Cygwin, but the Cygwin
LTTng-UST support was never completed.

Change-Id: I8bf5d3db94b979e16bf9b9b5c582b85b6b73f10b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove public tracepoint definition headers to 'lttng/tp'
Michael Jeanson [Wed, 17 Mar 2021 20:00:33 +0000 (16:00 -0400)] 
Move public tracepoint definition headers to 'lttng/tp'

Separate the tracepoint definition headers for tracef and tracelog from
the rest of the public API headers.

Change-Id: I8e38e2c8c0a3c2d6f7ab172c3fdbc2d6e5ad8d9d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoNamespace lttng/align.h as lttng/ust-align.h
Michael Jeanson [Wed, 17 Mar 2021 19:27:10 +0000 (15:27 -0400)] 
Namespace lttng/align.h as lttng/ust-align.h

Since the 'lttng/' header directory is shared between ust and tools,
namespace this common name header with 'ust-' to match the same pattern
as the other files.

Change-Id: Iad25ad76b75e87e040b4d7dd9f461ce6522ac361
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoNamespace lttng/bug.h as lttng/ust-bug.h
Michael Jeanson [Wed, 17 Mar 2021 19:19:37 +0000 (15:19 -0400)] 
Namespace lttng/bug.h as lttng/ust-bug.h

Since the 'lttng/' header directory is shared between ust and tools,
namespace this common name header with 'ust-' to match the same pattern
as the other files.

Change-Id: I08e853d9edcce218a9bd57717316a557f49200d7
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoNamespace enum lttng_ust_bytecode_interpreter_ret flags with lttng_ust_ prefix
Mathieu Desnoyers [Wed, 17 Mar 2021 20:23:25 +0000 (16:23 -0400)] 
Namespace enum lttng_ust_bytecode_interpreter_ret flags with lttng_ust_ prefix

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0106752714ab42f3f6c45191aee0d69d698b1cfe

3 years agoNamespace _float_mant_dig with lttng_ust_ prefix
Mathieu Desnoyers [Wed, 17 Mar 2021 20:16:48 +0000 (16:16 -0400)] 
Namespace _float_mant_dig with lttng_ust_ prefix

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I25085e6c9d93e6b0c4ff8392d263d53117505c40

3 years agoNamespace enumeration structures/enum with lttng_ust_ prefix
Mathieu Desnoyers [Wed, 17 Mar 2021 20:13:54 +0000 (16:13 -0400)] 
Namespace enumeration structures/enum with lttng_ust_ prefix

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icefbecc56d6425d2e6a3adebc592babf70ff60f9

3 years agoust-elf.h should be private, with public symbols
Mathieu Desnoyers [Wed, 17 Mar 2021 20:07:10 +0000 (16:07 -0400)] 
ust-elf.h should be private, with public symbols

The symbols belonging to ust-elf.h need to be public, because
liblttng-ust-dl uses them, but the header per se should be internal.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I04495249c0c8b80b251dbf2a7f5488d093a6d999

3 years agocounter-config.h should be private
Mathieu Desnoyers [Wed, 17 Mar 2021 20:01:53 +0000 (16:01 -0400)] 
counter-config.h should be private

Move it to libcounter/.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I28891c708d105c933bbe2c3cf656c7b7b6e6e550

3 years agoFix: perf counters context: error handling on type allocation
Mathieu Desnoyers [Wed, 17 Mar 2021 19:24:59 +0000 (15:24 -0400)] 
Fix: perf counters context: error handling on type allocation

Found by Coverity:
** CID 1450865:  Resource leaks  (RESOURCE_LEAK)
/liblttng-ust/lttng-context-perf-counters.c: 606 in lttng_add_perf_counter_to_ct)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9b0cf29ceb4f8c95f0905455cda4c157c7a37165

3 years agoFix: lttng_ust_destroy_type: add missing free() for compound types
Mathieu Desnoyers [Wed, 17 Mar 2021 19:23:26 +0000 (15:23 -0400)] 
Fix: lttng_ust_destroy_type: add missing free() for compound types

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iea05b0cad779adef251ec000e4c126493e17aff8

3 years agoFix: missing field name refactoring in java agent
Mathieu Desnoyers [Wed, 17 Mar 2021 18:56:46 +0000 (14:56 -0400)] 
Fix: missing field name refactoring in java agent

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I28fcf080545cad5bc44270419059bcaaa627572e

3 years agoFix: replace ringbuffer-config.h by ringbuffer-context.h include
Mathieu Desnoyers [Wed, 17 Mar 2021 18:39:10 +0000 (14:39 -0400)] 
Fix: replace ringbuffer-config.h by ringbuffer-context.h include

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5d1f3333c8906afaf632b82742d101683a13cd5c

3 years agoAdd missing ringbuffer-context.h
Mathieu Desnoyers [Wed, 17 Mar 2021 18:18:28 +0000 (14:18 -0400)] 
Add missing ringbuffer-context.h

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3dcf5b2c12c88570b9089b187d7e560af26e96af

3 years agoRefactoring: Privatize ring buffer config header
Mathieu Desnoyers [Wed, 17 Mar 2021 18:10:38 +0000 (14:10 -0400)] 
Refactoring: Privatize ring buffer config header

The public header ringbuffer-config.h contains two distinct sets of APIs
and structure declarations:

- Ring buffer configuration, which should become private (moved to
  libringbuffer/ringbuffer-config.h),
- Ring buffer context for use when writing an event record into the
  ring buffer. This part is moved to a new "ringbuffer-context.h" public
  header.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I07dae33ab5e3925dea0158058d484c49292a0bb0

3 years agoRefactoring: Introduce extensibility scheme for tracepoint structures
Mathieu Desnoyers [Wed, 17 Mar 2021 16:44:51 +0000 (12:44 -0400)] 
Refactoring: Introduce extensibility scheme for tracepoint structures

- Introduce struct_size extensibility scheme for all tracepoint public
  structures, except for struct lttng_ust_tracepoint_probe which is
  embedded in a public array of structures, thus making it tricky for
  instrumentation sites to efficiently skip over the array elements
  without reading their size.
- Remove padding from those structures.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2387a62c03f6f729c59ddc3fafa3a9b5546fb287

3 years agoClean-up: ustctl: adapt comment to use new ABI name
Jérémie Galarneau [Wed, 17 Mar 2021 16:20:05 +0000 (12:20 -0400)] 
Clean-up: ustctl: adapt comment to use new ABI name

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie099ab21cccd82212ad7339ae3c55dee685b54a0

3 years agoFix: ustctl: leak of event notifier data on communication error
Jérémie Galarneau [Wed, 17 Mar 2021 16:16:18 +0000 (12:16 -0400)] 
Fix: ustctl: leak of event notifier data on communication error

The `len != sizeof(*event_notifier)` error path does not free
the `event_notifier_data` even though it is not provided to the caller.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie3b4ebf77e8ca7205d802c6db67c23c347aa29df

3 years agoRefactoring: UST types public interfaces
Mathieu Desnoyers [Wed, 17 Mar 2021 02:41:20 +0000 (22:41 -0400)] 
Refactoring: UST types public interfaces

- Properly namespace public type interfaces with lttng_ust_ prefix,
- Move from union to parent embedding into children for inheritance.
- Introduce struct lttng_ust_type_common, which is fixed-size, to
  contain the type selector. Used as parent for each sub-type.
- Use compound literals on tracepoint probe definition rather than
  nesting into event field structure to allow each type to be extended
  with a struct_size scheme.
- The parent field is required to be the first field of each sub-type,
  allowing cast between parent and children types.
- Remove const-ness from various probe provider visible types to
  facilitate re-use of the code for eventual dynamically allocated
  structures.
- Remove "field_name" field from lttng_ust_ctx_field. Instead,
  dynamically allocate field names for each context.
- Introduce get_type_max_align() in lttng-context.c now used by
  lttng_context_update(). It performs a recursive traversal of the
  nested types rather than erroring out on recursive cases.
- Move "encoding" from integer type to array and sequences types.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If99a2689f042b7e642b373e4646e9f85c009a47d

3 years agoRefactoring: remove struct_size from struct lttng_ust_ctx_value
Mathieu Desnoyers [Wed, 17 Mar 2021 02:12:13 +0000 (22:12 -0400)] 
Refactoring: remove struct_size from struct lttng_ust_ctx_value

The struct_size scheme is not appropriate to extend struct
lttng_ust_ctx_value because its type selector and union already
act as a mean to extend it. When new entries are added to the union,
the size of that union may increase, thus shifting the offset of
fields following that union. It is therefore not possible to extend
it by adding fields after the union, thus making the struct_size
scheme irrelevant.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9e80e0ea87c3df3fe76863ed5343de733210045e

3 years agoRefactoring: struct lttng_ust_channel_ops
Mathieu Desnoyers [Tue, 16 Mar 2021 20:31:30 +0000 (16:31 -0400)] 
Refactoring: struct lttng_ust_channel_ops

- Move internal fields to struct lttng_ust_channel_ops_private.
- Add private/public relationships between the two structures.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id8018d8e11df6db569e20fffb6f2ed08e47c452e

3 years agoHide forward declaration of struct lttng_event_notifier_group
Mathieu Desnoyers [Tue, 16 Mar 2021 20:21:00 +0000 (16:21 -0400)] 
Hide forward declaration of struct lttng_event_notifier_group

Only used internally.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I71e26758404df22923371b76761eff9d1a4a8237

3 years agoNamepace struct lttng_session with lttng_ust_ prefix
Mathieu Desnoyers [Tue, 16 Mar 2021 20:19:34 +0000 (16:19 -0400)] 
Namepace struct lttng_session with lttng_ust_ prefix

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6f35753cda29c51f62cc90ccf7328a7255f77af7

3 years agoCleanup: public type macros coding style
Mathieu Desnoyers [Tue, 16 Mar 2021 20:17:26 +0000 (16:17 -0400)] 
Cleanup: public type macros coding style

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6732b20d1e2975f2a00678e00dc84c4ac6f7be67

3 years agoCleanup: Add whitelines after struct_size fields
Mathieu Desnoyers [Tue, 16 Mar 2021 20:11:37 +0000 (16:11 -0400)] 
Cleanup: Add whitelines after struct_size fields

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I78e521c17437a17b1a65fd4387ad422d2e79aa36

3 years agoRefactoring: context structures
Mathieu Desnoyers [Tue, 16 Mar 2021 18:51:18 +0000 (14:51 -0400)] 
Refactoring: context structures

The context structures are now hidden in headers which are not
installed, but those are still part of the UST ABI. Therefore, we need
to update them to make sure those are extensible.

- Namespace theses structures with lttng_ust_ prefix,
- Use struct_size extensibility scheme. There was no prior padding, so
  extensibility was an issue in the past.
- Remove padding.
- This requires that none of those structures can be nested. It also
  requires that all arrays of structures must be replaced by arrays of
  pointers to structures.
- Replace struct lttng_perf_counter_field pointer by a private data
  pointer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4ecb8f73652770f15c693c1b5b2acce3e871a64b

3 years agocleanup: add comments to lttng/ust-endian.h
Michael Jeanson [Mon, 15 Mar 2021 17:50:50 +0000 (13:50 -0400)] 
cleanup: add comments to lttng/ust-endian.h

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I60967d2791434dc513d36dbb8d7b671f13c0be7e

3 years agoNamespace 'struct channel' under 'lttng_ust_lib_ring_buffer_'
Michael Jeanson [Fri, 12 Mar 2021 20:27:26 +0000 (15:27 -0500)] 
Namespace 'struct channel' under 'lttng_ust_lib_ring_buffer_'

The major SONAME bump to '1' gives us the opportunity to properly
namespace some older parts of the API.

Change-Id: Iab40cde0c9ccc36d9fb537d665eb11d8d96da847
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove context types to private header
Michael Jeanson [Fri, 12 Mar 2021 19:04:44 +0000 (14:04 -0500)] 
Move context types to private header

This is an API change but the major SONAME bump to '1' gives us the
opportunity to hide symbols that should have been private from the
start.

Change-Id: Iad136e690b420e497b6b8d39155608278f537f7b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove lttng_ust_dl_update to private ABI
Michael Jeanson [Fri, 12 Mar 2021 15:50:00 +0000 (10:50 -0500)] 
Move lttng_ust_dl_update to private ABI

This symbol is part of the ABI between liblttng-ust-dl and liblltng-ust
and is not part of the public API.

Change-Id: Ic2a12568b8e0d78ec3493e644c797df1cf87c63b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoNamespace private ABI lttng_transport_find symbol
Michael Jeanson [Thu, 11 Mar 2021 21:48:47 +0000 (16:48 -0500)] 
Namespace private ABI lttng_transport_find symbol

The major SONAME bump to '1' gives us the opportunity to properly
namespace public symbols. This symbol is part of the ABI between
liblttng-ust-ctl and liblltng-ust and is not part of the public API.

Change-Id: Ibdb33aff98f7b974fac3c28889718851286ce2f9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoHide private lttng_session_active symbol
Michael Jeanson [Thu, 11 Mar 2021 21:40:02 +0000 (16:40 -0500)] 
Hide private lttng_session_active symbol

The major SONAME bump to '1' gives us the opportunity to hide private
symbols that should never have been visible.

Change-Id: I2700903465892d58d430bec0b76cde12018fede2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoNamespace lttng_context_procname_reset public symbol
Michael Jeanson [Thu, 11 Mar 2021 21:24:46 +0000 (16:24 -0500)] 
Namespace lttng_context_procname_reset public symbol

The major SONAME bump to '1' gives us the opportunity to properly
namespace public symbols. Note that this is also an API break.

Change-Id: I9f966ce7f4c112542f602e78a5e4f5c8f0d0f642
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoRemove LTTNG_HIDDEN macro
Michael Jeanson [Wed, 10 Mar 2021 19:09:52 +0000 (14:09 -0500)] 
Remove LTTNG_HIDDEN macro

We already use __attribute__((visibility("hidden"))) directly in the
public API and in some parts of the code. Remove the LTTNG_HIDDEN macro
and replace it with the literal attribute.

Change-Id: I9aa0698ba08c742c2a25aec24560b7789e303eaa
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoHide or namespace the remaining tracepoint internal symbols
Michael Jeanson [Tue, 9 Mar 2021 19:56:44 +0000 (14:56 -0500)] 
Hide or namespace the remaining tracepoint internal symbols

The major SONAME bump to '1' gives us the opportunity to hide private
symbols that should never have been visible.

Namespace the symbols that are part of the liblttng-ust-tracepoint ABI
but are not part of the public API.

Change-Id: I46125715e88f88891fe0c02a95adbbf6792a33e2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.04414 seconds and 4 git commands to generate.