lttng-ust.git
3 years agoMove creds.h to 'src/common/'
Michael Jeanson [Tue, 6 Apr 2021 23:17:41 +0000 (19:17 -0400)] 
Move creds.h to 'src/common/'

Change-Id: Ifbb7f9a1af76f1f2ae2bcaa9d7d625ffc2299bfa
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove futex wrapper to 'common/compat/'
Michael Jeanson [Tue, 6 Apr 2021 22:32:51 +0000 (18:32 -0400)] 
Move futex wrapper to 'common/compat/'

Change-Id: I9f1a31162f789bde101e08c5effa65449d631946
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoSplit ust-events-internal.h between common and liblttng-ust
Michael Jeanson [Sat, 3 Apr 2021 00:22:42 +0000 (20:22 -0400)] 
Split ust-events-internal.h between common and liblttng-ust

Split ust-events-internal.h into a common private header containing the
types and ABI functions and a header internal to liblttng-ust containing
the declaration of the private symbols.

Change-Id: I8ec2a5c8aad9ba85557b5a727ffc3615172e375d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove getenv to libcommon
Michael Jeanson [Tue, 6 Apr 2021 20:32:14 +0000 (16:32 -0400)] 
Move getenv to libcommon

Move it to libcommon since it can be used by any library.

Change-Id: Ic09b643e3a91b2844fe9dc13eac55fe90f8e15c2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove getcpu.h to 'lib/lttng-ust/'
Michael Jeanson [Tue, 6 Apr 2021 16:29:36 +0000 (12:29 -0400)] 
Move getcpu.h to 'lib/lttng-ust/'

Move getcpu.h from 'common/ringbuffer' to 'lib/lttng-ust', the
implementation is there and it provides some liblttng-ust symbols to
other components unrelated to the ringbuffer.

* Namespace internal symbols for clarity
* Add comments to the code.

Change-Id: I93da098dc9f90aa6324ad1ac36eaba1c660f0f64
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoSplit the common part of clock.h
Michael Jeanson [Tue, 6 Apr 2021 20:58:57 +0000 (16:58 -0400)] 
Split the common part of clock.h

Split clock.h into an internal liblttng-ust header and a common header
to allow access to 'lttng_ust_clock_init' which is part of the private
ABI of liblttng-ust.

Change-Id: Ic23ed01201edaebecb61ff071dd1d38281ff6de8
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove wait.h to 'src/common/'
Michael Jeanson [Tue, 6 Apr 2021 20:45:50 +0000 (16:45 -0400)] 
Move wait.h to 'src/common/'

It defines a generic macro that is only currently used in
liblttng-ust-ctl.

Change-Id: I9ed217176cf261f4fc410ba1655d0e9c0bf9ff07
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoRename internal ust_err to lttng_ust_logging
Michael Jeanson [Tue, 6 Apr 2021 19:56:58 +0000 (15:56 -0400)] 
Rename internal ust_err to lttng_ust_logging

This is an internal rename to reduce confusion with the public
ust-error.h API and better describe the functionality.

Change-Id: Ifc692c724ebd7b7bd4ad234fa92b95f50d724f5a
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust to 'src/lib/'
Michael Jeanson [Mon, 12 Apr 2021 19:19:23 +0000 (15:19 -0400)] 
Move liblttng-ust to 'src/lib/'

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I5df7b12202e4ba06bfb9532e8098ac80bd2073a2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agocleanup: convenience libs at root of 'src/common/'
Michael Jeanson [Mon, 12 Apr 2021 17:40:08 +0000 (13:40 -0400)] 
cleanup: convenience libs at root of 'src/common/'

Change-Id: I6e1b4790eaceef9a1f203e82e756bbe6b85cce77
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoSplit and move compat.h to 'common/compat/'
Michael Jeanson [Sat, 3 Apr 2021 00:52:58 +0000 (20:52 -0400)] 
Split and move compat.h to 'common/compat/'

Move compat.h to 'src/common/compat/' and split it in specific compat
headers.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: Ic34ddc11acf81d0463d69e23986d83c29be9023b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove the mmap wrapper to 'common/compat/'
Michael Jeanson [Fri, 2 Apr 2021 22:45:31 +0000 (18:45 -0400)] 
Move the mmap wrapper to 'common/compat/'

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I6fd5517793459c89fe22249ae08e844874a3a7fe
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove libustcomm to 'src/common/'
Michael Jeanson [Fri, 2 Apr 2021 23:35:53 +0000 (19:35 -0400)] 
Move libustcomm to 'src/common/'

libustcomm is an internal convience library used by both liblttng-ust
and liblttng-ust-ctl, move it to the common directory.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I6ec03e5d4fb0f49dee4dc57ba16ee025dd1151a2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove fd-tracker to liblttng-ust-common
Michael Jeanson [Mon, 12 Apr 2021 21:12:55 +0000 (17:12 -0400)] 
Move fd-tracker to liblttng-ust-common

The fd-tracker provides ABI symbols to liblttng-ust-ctl which shouldn't
link directy on liblttng-ust, move it to liblttng-ust-common to
accomodate this. This is in line with the goal to move the shared state
across our different libraries to ust-common.

Change-Id: I69de6a9e6eaec9599f22e47cb0292ef793f6115d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove libringbuffer to 'src/common/'
Michael Jeanson [Fri, 2 Apr 2021 22:45:31 +0000 (18:45 -0400)] 
Move libringbuffer to 'src/common/'

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I8f19a59bd0a72970199ede1b81c5d5971d613f31
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove libcounter to 'src/common/'
Michael Jeanson [Fri, 2 Apr 2021 19:38:41 +0000 (15:38 -0400)] 
Move libcounter to 'src/common/'

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I0c42a8b6bcd99a75d24114c1a4f610982ba16057
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-ctl to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 19:02:15 +0000 (15:02 -0400)] 
Move liblttng-ust-ctl to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I6a93f24016c38bf37e73d922a5a8a6ca2f4fa789
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-java* to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 18:30:00 +0000 (14:30 -0400)] 
Move liblttng-ust-java* to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I98ed0e9da28c111e62b189f26b0a225b5aa500e1
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-dl to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 18:25:52 +0000 (14:25 -0400)] 
Move liblttng-ust-dl to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I1e6a0597ed9ea79f661393a48f149a982f360d1d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-fd to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 18:22:45 +0000 (14:22 -0400)] 
Move liblttng-ust-fd to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I11fffd79c7f74ab602b115be94dfa28937e6ff2d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-cyg-profile to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 18:17:48 +0000 (14:17 -0400)] 
Move liblttng-ust-cyg-profile to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: Ia06cfce8b57db814dc17ba01829e1498c4cb7aea
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-libc-wrapper to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 18:13:14 +0000 (14:13 -0400)] 
Move liblttng-ust-libc-wrapper to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I81b23df257bbfe3490f6ee7836b93732fcfb9fb2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-python-agent to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 18:04:28 +0000 (14:04 -0400)] 
Move liblttng-ust-python-agent to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: If0eb731cc8f7faa860153f163b57f14292b7f522
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: event notifier group context leak
Mathieu Desnoyers [Tue, 13 Apr 2021 15:41:46 +0000 (11:41 -0400)] 
Fix: event notifier group context leak

The event notifier group should destroy its context when it is itself
destroyed.

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

3 years agoFix: perf counter context: leak event field structure
Mathieu Desnoyers [Tue, 13 Apr 2021 15:14:37 +0000 (11:14 -0400)] 
Fix: perf counter context: leak event field structure

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

3 years agoDocument nested type alignment field
Mathieu Desnoyers [Mon, 12 Apr 2021 13:30:05 +0000 (09:30 -0400)] 
Document nested type alignment field

Clarify that the alignment field for structure, sequence, and array
types is a minimum alignment.

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

3 years agoMove msgpack to libcommon
Michael Jeanson [Fri, 2 Apr 2021 19:29:21 +0000 (15:29 -0400)] 
Move msgpack to libcommon

msgpack provides common utils used across libraries, move it to
libcommon.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: Iaf8bb9e4504891f6072e68ac0ea24b8a13503e71
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd an internal 'libcommon' for utils
Michael Jeanson [Fri, 2 Apr 2021 19:19:51 +0000 (15:19 -0400)] 
Add an internal 'libcommon' for utils

Replicate the setup in tools and create a convenience library
for internal utils. Move the 'snprintf' component to this internal lib.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I4e8ad48eda64a093b7e169474ad454b74a237e09
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove internal headers to 'src/' dir
Michael Jeanson [Fri, 2 Apr 2021 18:45:42 +0000 (14:45 -0400)] 
Move internal headers to 'src/' dir

Move internal headers from the global 'include' directory to their
respective private directories under 'src/'. Remove the 'ust-' prefix
when appropriate as they are now included with the 'common/' path which
makes it easier to distinguish public and internal headers.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: If5510bbe9294ba1f0dcd4b101b363e7ef64e255d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd 'src' dir to global include path
Michael Jeanson [Fri, 2 Apr 2021 15:47:52 +0000 (11:47 -0400)] 
Add 'src' dir to global include path

The objective is to move internal headers from the global 'include'
directory to their respective private directories under 'src'.

Move the private generated 'config.h' to 'src/common/config.h', this way
it can be include with 'common/config.h' and reduce the risk of clashing
with a similarly named file.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: Ie62a81e46458bffb6d31af66411865f23cf1cb4f
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove all sources to 'src/'
Michael Jeanson [Fri, 2 Apr 2021 15:19:44 +0000 (11:19 -0400)] 
Move all sources to 'src/'

This will align the source tree structure with our other projects and
will make it easier to move the private headers currently located in the
global 'include' directory.

Change-Id: Ib016ec0c31de74990b1a8bb0792df2e7470bb994
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: pass private data to context callbacks
Mathieu Desnoyers [Wed, 7 Apr 2021 16:01:15 +0000 (12:01 -0400)] 
Fix: pass private data to context callbacks

commit 4e48b5d2debaf ("Refactoring: add back constness of public API structures")
changes the type of the first argument received by context callbacks
from a struct lttng_ust_ctx_field pointer to a void private data pointer.

That commit failed to change some call sites, which were still passing
the struct lttng_ust_ctx_field pointer rather than the private data
pointer. This was not caught by compiler errors because we are loosening
from a structure pointer to a void pointer.

Fixes: #1303
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I653f454b5dc4cfcc229b3a0e17b2dc6abe9fd658

3 years agoFix: app contexts: do not leak app context name, event field, context field
Mathieu Desnoyers [Tue, 6 Apr 2021 19:45:36 +0000 (15:45 -0400)] 
Fix: app contexts: do not leak app context name, event field, context field

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

3 years agoRemove TRACEPOINT_INCLUDE_FILE undef
Mathieu Desnoyers [Tue, 6 Apr 2021 17:46:50 +0000 (13:46 -0400)] 
Remove TRACEPOINT_INCLUDE_FILE undef

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

3 years agoRemove TRACEPOINT_INCLUDE_FILE macro
Mathieu Desnoyers [Tue, 6 Apr 2021 17:45:42 +0000 (13:45 -0400)] 
Remove TRACEPOINT_INCLUDE_FILE macro

Now that we bump the soname major version, we can remove old macros
which only purpose is compatibility with LTTng-UST 2.0.

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

3 years agoRemove app context backward compatibility dead code
Mathieu Desnoyers [Tue, 6 Apr 2021 17:39:06 +0000 (13:39 -0400)] 
Remove app context backward compatibility dead code

This code is unused since the recent ABI break which removes backward
compatibility.

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

3 years agoCleanup: Unaligned vs aligned ring buffer access comment
Mathieu Desnoyers [Tue, 6 Apr 2021 17:34:29 +0000 (13:34 -0400)] 
Cleanup: Unaligned vs aligned ring buffer access comment

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

3 years agoUpdate unaligned vs aligned ring buffer access comment
Mathieu Desnoyers [Mon, 5 Apr 2021 21:37:52 +0000 (17:37 -0400)] 
Update unaligned vs aligned ring buffer access comment

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

3 years agoRefactoring: add back constness of public API structures
Mathieu Desnoyers [Mon, 5 Apr 2021 12:32:11 +0000 (08:32 -0400)] 
Refactoring: add back constness of public API structures

Probes defining type, enumeration label, enumeration description,
event, and probe structures should be able to define them as "const",
because those are indeed const data which never need to be changed by
the tracer.

In order to allow struct lttng_ust_probe_desc definition to be constant,
move the "head", "lazy_init_head" and "lazy" fields to an internal
structure, "struct lttng_ust_registered_probe". It is opaque from the
point of view of the probe provider, but its pointer is now used as a
cookie between registration and unregistration. Moving the list heads
into an internal structure is an overall cleanup hiding private data
from the public API.

Use a similar scheme for registration of the context provider:
internalize the "hlist" field into an internal registration structure
(opaque from the point of view of the public API), which is now used as
a cookie between registration and unregistration.

This allows to fix an issue which was introduced by a prior refactoring
of the code dealing with contexts: the RCU update of context callbacks
was broken because the context fields were shared between the old and
the new array of contexts, thus leading to non-atomic update of the 3
callback pointers. This is fixed by making struct lttng_ust_ctx private,
and changing the array of pointers to context fields to an array of
context fields.

The functions lttng_ust_context_set_session_provider,
lttng_ust_add_app_context_to_ctx_rcu, and
lttng_ust_context_set_provider_rcu are now private.

For all contexts except the "perf" context fields, define the context
field as a static const variable rather than use memory allocation. This
means freeing the event field and type is not required anymore, and the
perf context field is handled through a destroy callback using the
private data pointer.

Move struct lttng_ust_ctx_field to an internal header. The only reason
why it was public is because the callbacks expected it as an argument.
Change the callbacks to receive a private data pointer instead to
achieve the same goal without exposing our internal structures.

The internal helpers lttng_ust_create_type_integer,
lttng_ust_create_type_array_text and lttng_ust_destroy_type are removed,
and replaced by internal macro helpers lttng_ust_static_type_integer,
lttng_ust_static_type_array_text, lttng_ust_static_event_field, and
lttng_ust_static_ctx_field, to facilitate static definitions in context
code.

Because there is no need to embed list and hlist nodes in the probe
descriptor nor the context provider, there is no need to include those
list headers from public APIs anymore.

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

3 years agoAdd 'ctf_unused' tracepoint field type
Michael Jeanson [Wed, 31 Mar 2021 21:52:30 +0000 (17:52 -0400)] 
Add 'ctf_unused' tracepoint field type

Some tracepoint definitions have one or more arguments that don't have a
corresponding field to allow passing a value to a probe without
recording it in the trace buffer nor using it in the filter.

This results in tracepoint macros generating inline functions with unused
arguments which prevents us from turning on -Wunuse-parameter.

Add a new tracepoint field type name 'ctf_unused' to adress this and
properly handle unused values in the tracepoint macros.

[ Mathieu: ctf_unused() takes only the _src parameter, no "type",
  because an unused "field" does not have any representation in the ring
  buffer nor the filter. If this ends up limiting us in the future, I
  accept all the blame. ]

Change-Id: I56d8024926340e9c965ca01fa24a0fff7b7c5baa
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agocleanup: explicitly mark unused parameters (-Wunused-parameter)
Michael Jeanson [Wed, 31 Mar 2021 16:19:05 +0000 (12:19 -0400)] 
cleanup: explicitly mark unused parameters (-Wunused-parameter)

Add the 'unused' attribute to function parameters that are unused to
allow turning on -Wunused-parameter and distinguish unused parameters
that are actual errors.

Change-Id: I5a4b3790ae84da0c5135a214f2a63b513bb199eb
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agocleanup: rename template headers
Michael Jeanson [Wed, 24 Mar 2021 19:28:18 +0000 (15:28 -0400)] 
cleanup: rename template headers

Rename the ring buffer client template headers to make it more obvious
they are templates and not regular headers.

Change-Id: I0916331d32c8602edf92615e92efec45a4b0ee1e
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: string constants (-Wwrite-strings)
Michael Jeanson [Fri, 26 Mar 2021 19:34:21 +0000 (15:34 -0400)] 
fix: string constants (-Wwrite-strings)

Do not use an anonymous string literal with a non-const char pointer as
this will discard the implicit const, use static non-const string
instead when appropriate. Otherwise, we could end up trying to write to
a string constant.

Change-Id: Ie2bb0e5ab7978930f9edcdb379bd181caaacc15c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: all functions have declarations (-Wmissing-prototypes -Wold-style-definition)
Michael Jeanson [Wed, 24 Mar 2021 20:12:34 +0000 (16:12 -0400)] 
fix: all functions have declarations (-Wmissing-prototypes -Wold-style-definition)

Make sure that all non-static functions have a declaration.

Change-Id: I4057795631c53c4281127457a1ee5a538ee7fcce
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agocleanup: function attribute 'always_inline'
Michael Jeanson [Tue, 30 Mar 2021 23:30:49 +0000 (19:30 -0400)] 
cleanup: function attribute 'always_inline'

Function attributes should be located after the declaration.

Change-Id: If2b7dbb9a80870ec403b6ffbd115154dd739b508
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agocleanup: function attribute 'hidden'
Michael Jeanson [Tue, 30 Mar 2021 19:44:02 +0000 (15:44 -0400)] 
cleanup: function attribute 'hidden'

Function attributes should be located after the declaration.

Change-Id: I519421804e62181b49173f9239a43d6d9c21c216
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agocleanup: function attribute 'no_instrument_function'
Michael Jeanson [Tue, 30 Mar 2021 19:42:44 +0000 (15:42 -0400)] 
cleanup: function attribute 'no_instrument_function'

Function attributes should be located after the declaration.

Change-Id: I88688e01ca54f525c4c20173c5e8e36b5f2740fa
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agocleanup: function attribute 'destructor'
Michael Jeanson [Tue, 30 Mar 2021 19:35:19 +0000 (15:35 -0400)] 
cleanup: function attribute 'destructor'

Function attributes should be located after the declaration.

Change-Id: Iad766f5861a6b2de0d9dd3a0f87909ed7f8dc092
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agocleanup: function attribute 'constructor'
Michael Jeanson [Tue, 30 Mar 2021 19:29:42 +0000 (15:29 -0400)] 
cleanup: function attribute 'constructor'

Function attributes should be located after the declaration.

Change-Id: Ie3ef444bf150824b3a57e8485417f019cecc61be
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agocleanup: function attribute 'unused'
Michael Jeanson [Tue, 30 Mar 2021 19:19:13 +0000 (15:19 -0400)] 
cleanup: function attribute 'unused'

Function attributes should be located after the declaration.

Change-Id: I62e4c3e521705756b99571281937bba6d5a6d063
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agotests: benchmark: improve benchmark scalability accuracy
Mathieu Desnoyers [Wed, 31 Mar 2021 14:27:32 +0000 (10:27 -0400)] 
tests: benchmark: improve benchmark scalability accuracy

Testing with a fixed number of loops per-thread only works if the
workload is distributed perfectly across CPUs. For instance, if a lock
is held in the workload (e.g. internally by open() and close()), those
may cause starvation of some threads, and therefore cause the benchmark
to be wrong because it will wait for the slowest thread to complete its
loops.

It is also not good for testing overcommit of threads vs cpus.

Change the test to report the number of loops performed in a given wall
time, and use this to report the average and std.dev. of tracing
overhead per event on each active CPU.

Change the benchmark workload to be only CPU-bound and not generate
system calls to minimize the inherent non-scalability of the workload
(e.g. locks held within the kernel).

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

3 years agotests: benchmark: use cpu-bound workload, calculate average and std.dev.
Mathieu Desnoyers [Wed, 31 Mar 2021 00:05:44 +0000 (20:05 -0400)] 
tests: benchmark: use cpu-bound workload, calculate average and std.dev.

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

3 years agotests: improve benchmark script
Mathieu Desnoyers [Tue, 30 Mar 2021 20:33:26 +0000 (16:33 -0400)] 
tests: improve benchmark script

Kill session daemon after script, conditionally drop caches if root
(else it is forbidden to do so), handle cleanup on trap, use snapshot
(flight recorder) tracing to benchmark ring buffer, output the result in
nanoseconds, removing trailing numbers after dot.

Before this, the test was pretty much always resulting in an output of
"0s" extra overhead due to truncation of significant numbers in the
output.

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

3 years agocleanup: function attribute 'format'
Michael Jeanson [Tue, 30 Mar 2021 19:10:57 +0000 (15:10 -0400)] 
cleanup: function attribute 'format'

Function attributes should be located after the declaration.

Change-Id: I1c1622b3102f4a9d2fc5df35b5dfc290abac48aa
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: liblttng-ust-ctl: missing ring buffer and counter clients init/exit symbols
Mathieu Desnoyers [Tue, 30 Mar 2021 19:59:02 +0000 (15:59 -0400)] 
Fix: liblttng-ust-ctl: missing ring buffer and counter clients init/exit symbols

Move init/exit functions to ust-core.c which is linked against by both
liblttng-ust and liblttng-ust-ctl to make them available to the control
library.

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

3 years agoNew API: lttng_ust_init_thread() for async-signal tracing
Mathieu Desnoyers [Tue, 30 Mar 2021 13:54:23 +0000 (09:54 -0400)] 
New API: lttng_ust_init_thread() for async-signal tracing

LTTng-UST uses Global Dynamic model TLS variables rather than IE
model because many versions of glibc don't preallocate a pool large
enough for TLS variables IE model defined in other shared libraries,
and causes issues when using LTTng-UST for Java tracing.

Because of this use of Global Dynamic TLS variables, users wishing to
trace from signal handlers need to explicitly trigger the lazy
allocation of those variables for each thread before using them.
This can be triggered by calling lttng_ust_init_thread().

Hide the public symbols for ring buffer and counter clients init/exit.
Expose new symbols for init/exit of all ring buffer and counter clients
instead. Those new symbols are only used by liblttng-ust-ctl, and are
thus in an internal header.

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

3 years agofix: redundant decl of channel_destroy (-Wredundant-decls)
Michael Jeanson [Wed, 24 Mar 2021 23:05:55 +0000 (19:05 -0400)] 
fix: redundant decl of channel_destroy (-Wredundant-decls)

Change-Id: If1ebe0225a848936bf94fb98edf19884909295ee
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: tls-compat with hidden ring buffer context
Mathieu Desnoyers [Tue, 30 Mar 2021 16:07:51 +0000 (12:07 -0400)] 
Fix: tls-compat with hidden ring buffer context

There are additional missing URCU_TLS() accessors in the refactoring of
the ring buffer context. Moreover, when indexing an array, it must be
done outside of the URCU_TLS() accessor.

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

3 years agoFix: tls-compat with hidden ring buffer context
Mathieu Desnoyers [Tue, 30 Mar 2021 16:03:32 +0000 (12:03 -0400)] 
Fix: tls-compat with hidden ring buffer context

There is a missing URCU_TLS() accessor in the refactoring of the ring
buffer context, which fails the tls-compat build.

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

3 years agoRefactoring: hide internal fields of ring buffer context
Mathieu Desnoyers [Mon, 29 Mar 2021 20:32:58 +0000 (16:32 -0400)] 
Refactoring: hide internal fields of ring buffer context

The public ring buffer context is allocated on the probe stack, but
contains many internal fields which are of no use to the probe. They
belong to that structure for the sake of passing information between
reserve, write, commit, strcpy, and other ring buffer callbacks.

Move those fields to a newly introduced private data structure, which is
allocated into a TLS stack belonging to the ring buffer client. It is
indexed with the TLS ring buffer nesting counter to allow recursive use
of the ring buffer (e.g. signal handlers).

While doing this, also move the "offset alignment" operation to the ring
buffer write callback. The alignment is now an additional parameter
expected by the write callback. Note that the strcpy and pstrcpy_pad
callbacks never need to do any alignment, so simply remove those
no-op alignments.

The event reserve callback does not need to have an explicit event id
parameter. It can fetch it from the client private data.

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

3 years agoMove private ABI counter client symbols to dedicated header
Michael Jeanson [Wed, 24 Mar 2021 18:44:05 +0000 (14:44 -0400)] 
Move private ABI counter client symbols to dedicated header

The counter client percpu functions are provided by liblttng-ust and used
by liblttng-ust-ctl. Make them part of the private ABI.

Change-Id: I5fe3c16cb46ac3998dbdc037ccdb71170fc03f61
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: add fallthrough annotations (-Wimplicit-fallthrough)
Michael Jeanson [Wed, 24 Mar 2021 23:28:52 +0000 (19:28 -0400)] 
fix: add fallthrough annotations (-Wimplicit-fallthrough)

Change-Id: I7d6c1197d6ff126f2c6fe6fb6ad8a0f575fc661d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: add format attribute to relevant functions (-Wsuggest-attribute=format)
Michael Jeanson [Fri, 26 Mar 2021 18:37:35 +0000 (14:37 -0400)] 
fix: add format attribute to relevant functions (-Wsuggest-attribute=format)

Change-Id: Ie0828d4bbf560275cc8e1cd550737f8be2ab0aae
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: use proper format specifiers in tests (-Wformat)
Michael Jeanson [Fri, 26 Mar 2021 18:36:30 +0000 (14:36 -0400)] 
fix: use proper format specifiers in tests (-Wformat)

Also rework the snprintf test to not use a 'gnu_printf' style format
string as the function is annotated as expecting 'printf' style.

Change-Id: Idca3a4003bcb06c70795bff399a7698fada041ca
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: shadowed local variable in macros (-Wshadow)
Michael Jeanson [Wed, 24 Mar 2021 21:03:46 +0000 (17:03 -0400)] 
fix: shadowed local variable in macros (-Wshadow)

Add a prefix to the local variable names defined in the PERROR macro to
reduce the risk of shadowing variables with generic names.

Remove the local variable '____ptr_ret' in the shmp_index macro

Change-Id: I5d33e8eb4c760ffb527ac02cf8901105b500b28d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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>
This page took 0.044367 seconds and 4 git commands to generate.