From 8cd08025a83fe1907c6fd04f94c8f9ae362c3da7 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Thu, 22 Apr 2021 18:36:47 -0400 Subject: [PATCH] Move the ringbuffer and counter clients to 'src/common/' The clients are used by both liblttng-ust and liblttng-ust-ctl, now that the clock and getcpu plugins on which they depend have been moved to liblttng-ust-common, they can be extracted from liblttng-ust-ctl and move to common convenience libraries. Change-Id: I8384570007950ca18d00759790cb5264b7c3b528 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- src/common/Makefile.am | 27 ++++++ .../lttng-ust/ust-core.c => common/core.c} | 41 ++------- src/common/counter-clients/clients.c | 19 +++++ .../counter-clients/clients.h} | 16 ++-- .../counter-clients/percpu-32-modular.c} | 8 +- .../counter-clients/percpu-64-modular.c} | 8 +- src/common/counter/counter-api.h | 1 + src/common/counter/counter-internal.h | 2 + src/common/events.h | 3 - src/common/ringbuffer-clients/clients.c | 25 ++++++ .../ringbuffer-clients/clients.h} | 19 +++-- .../ringbuffer-clients/discard-rt.c} | 6 +- .../ringbuffer-clients/discard.c} | 6 +- .../ringbuffer-clients/metadata-template.h} | 9 +- .../ringbuffer-clients/metadata.c} | 4 +- .../ringbuffer-clients/overwrite-rt.c} | 6 +- .../ringbuffer-clients/overwrite.c} | 6 +- .../ringbuffer-clients/template.h} | 9 +- src/common/tracer.h | 84 +++++++++++++++++++ src/lib/lttng-ust-ctl/Makefile.am | 5 +- src/lib/lttng-ust-ctl/ustctl.c | 6 +- src/lib/lttng-ust/Makefile.am | 42 +++------- src/lib/lttng-ust/context-internal.h | 3 - src/lib/lttng-ust/events.h | 12 --- src/lib/lttng-ust/lttng-bytecode-specialize.c | 1 + src/lib/lttng-ust/lttng-bytecode.c | 1 + src/lib/lttng-ust/lttng-context-provider.c | 1 + src/lib/lttng-ust/lttng-events.c | 2 +- src/lib/lttng-ust/lttng-tracer-core.h | 22 ----- src/lib/lttng-ust/lttng-tracer.h | 43 ---------- src/lib/lttng-ust/lttng-ust-abi.c | 3 +- src/lib/lttng-ust/lttng-ust-comm.c | 4 +- 32 files changed, 238 insertions(+), 206 deletions(-) rename src/{lib/lttng-ust/ust-core.c => common/core.c} (82%) create mode 100644 src/common/counter-clients/clients.c rename src/{lib/lttng-ust/lttng-counter-client.h => common/counter-clients/clients.h} (64%) rename src/{lib/lttng-ust/lttng-counter-client-percpu-32-modular.c => common/counter-clients/percpu-32-modular.c} (96%) rename src/{lib/lttng-ust/lttng-counter-client-percpu-64-modular.c => common/counter-clients/percpu-64-modular.c} (96%) create mode 100644 src/common/ringbuffer-clients/clients.c rename src/{lib/lttng-ust/lttng-rb-clients.h => common/ringbuffer-clients/clients.h} (88%) rename src/{lib/lttng-ust/lttng-ring-buffer-client-discard-rt.c => common/ringbuffer-clients/discard-rt.c} (85%) rename src/{lib/lttng-ust/lttng-ring-buffer-client-discard.c => common/ringbuffer-clients/discard.c} (84%) rename src/{lib/lttng-ust/lttng-ring-buffer-metadata-client-template.h => common/ringbuffer-clients/metadata-template.h} (99%) rename src/{lib/lttng-ust/lttng-ring-buffer-metadata-client.c => common/ringbuffer-clients/metadata.c} (86%) rename src/{lib/lttng-ust/lttng-ring-buffer-client-overwrite-rt.c => common/ringbuffer-clients/overwrite-rt.c} (85%) rename src/{lib/lttng-ust/lttng-ring-buffer-client-overwrite.c => common/ringbuffer-clients/overwrite.c} (84%) rename src/{lib/lttng-ust/lttng-ring-buffer-client-template.h => common/ringbuffer-clients/template.h} (99%) create mode 100644 src/common/tracer.h delete mode 100644 src/lib/lttng-ust/lttng-tracer.h diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 4692e24c..ed798b3b 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -24,6 +24,7 @@ noinst_HEADERS = \ procname.h \ safe-snprintf.h \ tracepoint.h \ + tracer.h \ wait.h noinst_HEADERS += \ @@ -50,8 +51,10 @@ noinst_HEADERS += \ noinst_LTLIBRARIES = \ libcounter.la \ + libcounter-clients.la \ libmsgpack.la \ libringbuffer.la \ + libringbuffer-clients.la \ libsnprintf.la \ libcommon.la \ libustcomm.la @@ -77,6 +80,15 @@ endif libcounter_la_CFLAGS = -DUST_COMPONENT="libcounter" $(AM_CFLAGS) +# counter-clients +libcounter_clients_la_SOURCES = \ + counter-clients/clients.c \ + counter-clients/clients.h \ + counter-clients/percpu-32-modular.c \ + counter-clients/percpu-64-modular.c + +libcounter_clients_la_CFLAGS = -DUST_COMPONENT="libcounter-clients" $(AM_CFLAGS) + # msgpack libmsgpack_la_SOURCES = \ msgpack/msgpack.c \ @@ -114,6 +126,20 @@ endif libringbuffer_la_CFLAGS = -DUST_COMPONENT="libringbuffer" $(AM_CFLAGS) +# ringbuffer-client +libringbuffer_clients_la_SOURCES = \ + ringbuffer-clients/clients.c \ + ringbuffer-clients/clients.h \ + ringbuffer-clients/discard.c \ + ringbuffer-clients/discard-rt.c \ + ringbuffer-clients/metadata.c \ + ringbuffer-clients/metadata-template.h \ + ringbuffer-clients/overwrite.c \ + ringbuffer-clients/overwrite-rt.c \ + ringbuffer-clients/template.h + +libringbuffer_clients_la_CFLAGS = -DUST_COMPONENT="libringbuffer-clients" $(AM_CFLAGS) + # snprintf libsnprintf_la_SOURCES = \ snprintf/fflush.c \ @@ -131,6 +157,7 @@ libsnprintf_la_SOURCES = \ # Common library libcommon_la_SOURCES = \ + core.c \ dynamic-type.c \ dynamic-type.h \ elf.c \ diff --git a/src/lib/lttng-ust/ust-core.c b/src/common/core.c similarity index 82% rename from src/lib/lttng-ust/ust-core.c rename to src/common/core.c index e547a497..8ea3e34a 100644 --- a/src/lib/lttng-ust/ust-core.c +++ b/src/common/core.c @@ -9,14 +9,16 @@ #include #include -#include "context-internal.h" -#include "lib/lttng-ust/events.h" +#include + #include "common/logging.h" -#include "lttng-tracer-core.h" -#include "lttng-rb-clients.h" -#include "lttng-counter-client.h" +#include "common/tracer.h" #include "common/jhash.h" + +/* + * Each library using the transports will have its local lists. + */ static CDS_LIST_HEAD(lttng_transport_list); static CDS_LIST_HEAD(lttng_counter_transport_list); @@ -175,32 +177,3 @@ void lttng_ust_free_channel_common(struct lttng_ust_channel_common *chan) } } -void lttng_ust_ring_buffer_clients_init(void) -{ - lttng_ring_buffer_metadata_client_init(); - lttng_ring_buffer_client_overwrite_init(); - lttng_ring_buffer_client_overwrite_rt_init(); - lttng_ring_buffer_client_discard_init(); - lttng_ring_buffer_client_discard_rt_init(); -} - -void lttng_ust_ring_buffer_clients_exit(void) -{ - lttng_ring_buffer_client_discard_rt_exit(); - lttng_ring_buffer_client_discard_exit(); - lttng_ring_buffer_client_overwrite_rt_exit(); - lttng_ring_buffer_client_overwrite_exit(); - lttng_ring_buffer_metadata_client_exit(); -} - -void lttng_ust_counter_clients_init(void) -{ - lttng_counter_client_percpu_64_modular_init(); - lttng_counter_client_percpu_32_modular_init(); -} - -void lttng_ust_counter_clients_exit(void) -{ - lttng_counter_client_percpu_32_modular_exit(); - lttng_counter_client_percpu_64_modular_exit(); -} diff --git a/src/common/counter-clients/clients.c b/src/common/counter-clients/clients.c new file mode 100644 index 00000000..e22667c6 --- /dev/null +++ b/src/common/counter-clients/clients.c @@ -0,0 +1,19 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (C) 2011 Mathieu Desnoyers + */ + +#include "common/counter-clients/clients.h" + +void lttng_ust_counter_clients_init(void) +{ + lttng_counter_client_percpu_64_modular_init(); + lttng_counter_client_percpu_32_modular_init(); +} + +void lttng_ust_counter_clients_exit(void) +{ + lttng_counter_client_percpu_32_modular_exit(); + lttng_counter_client_percpu_64_modular_exit(); +} diff --git a/src/lib/lttng-ust/lttng-counter-client.h b/src/common/counter-clients/clients.h similarity index 64% rename from src/lib/lttng-ust/lttng-counter-client.h rename to src/common/counter-clients/clients.h index 2a0a3455..41aefb22 100644 --- a/src/lib/lttng-ust/lttng-counter-client.h +++ b/src/common/counter-clients/clients.h @@ -6,16 +6,14 @@ * LTTng lib counter client. */ -#ifndef _LTTNG_UST_COUNTER_CLIENT_H -#define _LTTNG_UST_COUNTER_CLIENT_H +#ifndef _UST_COMMON_COUNTER_CLIENTS_CLIENTS_H +#define _UST_COMMON_COUNTER_CLIENTS_CLIENTS_H -/* - * The counter clients init/exit symbols are private ABI for - * liblttng-ust-ctl, which is why they are not hidden. - */ +void lttng_ust_counter_clients_init(void) + __attribute__((visibility("hidden"))); -void lttng_ust_counter_clients_init(void); -void lttng_ust_counter_clients_exit(void); +void lttng_ust_counter_clients_exit(void) + __attribute__((visibility("hidden"))); void lttng_counter_client_percpu_32_modular_init(void) __attribute__((visibility("hidden"))); @@ -29,4 +27,4 @@ void lttng_counter_client_percpu_64_modular_init(void) void lttng_counter_client_percpu_64_modular_exit(void) __attribute__((visibility("hidden"))); -#endif +#endif /* _UST_COMMON_COUNTER_CLIENTS_CLIENTS_H */ diff --git a/src/lib/lttng-ust/lttng-counter-client-percpu-32-modular.c b/src/common/counter-clients/percpu-32-modular.c similarity index 96% rename from src/lib/lttng-ust/lttng-counter-client-percpu-32-modular.c rename to src/common/counter-clients/percpu-32-modular.c index 0f9f5fe4..3635e5f3 100644 --- a/src/lib/lttng-ust/lttng-counter-client-percpu-32-modular.c +++ b/src/common/counter-clients/percpu-32-modular.c @@ -8,11 +8,11 @@ * Copyright (C) 2020 Mathieu Desnoyers */ -#include "lib/lttng-ust/events.h" -#include "common/counter/counter.h" +#include "common/counter-clients/clients.h" #include "common/counter/counter-api.h" -#include "lttng-tracer-core.h" -#include "lttng-counter-client.h" +#include "common/counter/counter.h" +#include "common/events.h" +#include "common/tracer.h" static const struct lib_counter_config client_config = { .alloc = COUNTER_ALLOC_PER_CPU, diff --git a/src/lib/lttng-ust/lttng-counter-client-percpu-64-modular.c b/src/common/counter-clients/percpu-64-modular.c similarity index 96% rename from src/lib/lttng-ust/lttng-counter-client-percpu-64-modular.c rename to src/common/counter-clients/percpu-64-modular.c index 62ddfe5d..2aee4197 100644 --- a/src/lib/lttng-ust/lttng-counter-client-percpu-64-modular.c +++ b/src/common/counter-clients/percpu-64-modular.c @@ -8,11 +8,11 @@ * Copyright (C) 2020 Mathieu Desnoyers */ -#include "lib/lttng-ust/events.h" -#include "common/counter/counter.h" +#include "common/counter-clients/clients.h" #include "common/counter/counter-api.h" -#include "lttng-tracer-core.h" -#include "lttng-counter-client.h" +#include "common/counter/counter.h" +#include "common/events.h" +#include "common/tracer.h" static const struct lib_counter_config client_config = { .alloc = COUNTER_ALLOC_PER_CPU, diff --git a/src/common/counter/counter-api.h b/src/common/counter/counter-api.h index 404ec9b5..ce2bf06a 100644 --- a/src/common/counter/counter-api.h +++ b/src/common/counter/counter-api.h @@ -11,6 +11,7 @@ #include #include +#include #include "counter.h" #include "counter-internal.h" #include diff --git a/src/common/counter/counter-internal.h b/src/common/counter/counter-internal.h index 10668ecf..fbce7de0 100644 --- a/src/common/counter/counter-internal.h +++ b/src/common/counter/counter-internal.h @@ -10,6 +10,8 @@ #define _LTTNG_COUNTER_INTERNAL_H #include +#include + #include #include #include "counter-types.h" diff --git a/src/common/events.h b/src/common/events.h index bba28cc2..fdf95aed 100644 --- a/src/common/events.h +++ b/src/common/events.h @@ -571,9 +571,6 @@ struct lttng_enabler *lttng_event_notifier_enabler_as_enabler( -/* This is ABI between liblttng-ust and liblttng-ust-ctl */ -struct lttng_transport *lttng_ust_transport_find(const char *name); - /* This is ABI between liblttng-ust and liblttng-ust-dl */ void lttng_ust_dl_update(void *ip); diff --git a/src/common/ringbuffer-clients/clients.c b/src/common/ringbuffer-clients/clients.c new file mode 100644 index 00000000..f59aa06e --- /dev/null +++ b/src/common/ringbuffer-clients/clients.c @@ -0,0 +1,25 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (C) 2011 Mathieu Desnoyers + */ + +#include "common/ringbuffer-clients/clients.h" + +void lttng_ust_ring_buffer_clients_init(void) +{ + lttng_ring_buffer_metadata_client_init(); + lttng_ring_buffer_client_overwrite_init(); + lttng_ring_buffer_client_overwrite_rt_init(); + lttng_ring_buffer_client_discard_init(); + lttng_ring_buffer_client_discard_rt_init(); +} + +void lttng_ust_ring_buffer_clients_exit(void) +{ + lttng_ring_buffer_client_discard_rt_exit(); + lttng_ring_buffer_client_discard_exit(); + lttng_ring_buffer_client_overwrite_rt_exit(); + lttng_ring_buffer_client_overwrite_exit(); + lttng_ring_buffer_metadata_client_exit(); +} diff --git a/src/lib/lttng-ust/lttng-rb-clients.h b/src/common/ringbuffer-clients/clients.h similarity index 88% rename from src/lib/lttng-ust/lttng-rb-clients.h rename to src/common/ringbuffer-clients/clients.h index 5e09c2b2..663894d2 100644 --- a/src/lib/lttng-ust/lttng-rb-clients.h +++ b/src/common/ringbuffer-clients/clients.h @@ -4,10 +4,12 @@ * Copyright (C) 2013 Mathieu Desnoyers */ -#ifndef _LTTNG_RB_CLIENT_H -#define _LTTNG_RB_CLIENT_H +#ifndef _UST_COMMON_RINGBUFFER_CLIENTS_CLIENTS_H +#define _UST_COMMON_RINGBUFFER_CLIENTS_CLIENTS_H #include +#include + #include "common/ringbuffer/ringbuffer-config.h" struct lttng_ust_client_lib_ring_buffer_client_cb { @@ -40,12 +42,11 @@ struct lttng_ust_client_lib_ring_buffer_client_cb { struct lttng_ust_ring_buffer_channel *chan, uint64_t *id); }; -/* - * The ring buffer clients init/exit symbols are private ABI for - * liblttng-ust-ctl, which is why they are not hidden. - */ -void lttng_ust_ring_buffer_clients_init(void); -void lttng_ust_ring_buffer_clients_exit(void); +void lttng_ust_ring_buffer_clients_init(void) + __attribute__((visibility("hidden"))); + +void lttng_ust_ring_buffer_clients_exit(void) + __attribute__((visibility("hidden"))); void lttng_ring_buffer_client_overwrite_init(void) __attribute__((visibility("hidden"))); @@ -91,4 +92,4 @@ void lttng_ust_ring_buffer_client_discard_alloc_tls(void) void lttng_ust_ring_buffer_client_discard_rt_alloc_tls(void) __attribute__((visibility("hidden"))); -#endif /* _LTTNG_RB_CLIENT_H */ +#endif /* _UST_COMMON_RINGBUFFER_CLIENTS_CLIENTS_H */ diff --git a/src/lib/lttng-ust/lttng-ring-buffer-client-discard-rt.c b/src/common/ringbuffer-clients/discard-rt.c similarity index 85% rename from src/lib/lttng-ust/lttng-ring-buffer-client-discard-rt.c rename to src/common/ringbuffer-clients/discard-rt.c index 71279ccf..095aa4e2 100644 --- a/src/lib/lttng-ust/lttng-ring-buffer-client-discard-rt.c +++ b/src/common/ringbuffer-clients/discard-rt.c @@ -7,8 +7,8 @@ */ #define _LGPL_SOURCE -#include "lttng-tracer.h" -#include "lttng-rb-clients.h" +#include "common/tracer.h" +#include "common/ringbuffer-clients/clients.h" #define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_DISCARD #define RING_BUFFER_MODE_TEMPLATE_STRING "discard-rt" @@ -20,4 +20,4 @@ lttng_ring_buffer_client_discard_rt_exit #define LTTNG_CLIENT_TYPE LTTNG_CLIENT_DISCARD_RT #define LTTNG_CLIENT_WAKEUP RING_BUFFER_WAKEUP_BY_TIMER -#include "lttng-ring-buffer-client-template.h" +#include "common/ringbuffer-clients/template.h" diff --git a/src/lib/lttng-ust/lttng-ring-buffer-client-discard.c b/src/common/ringbuffer-clients/discard.c similarity index 84% rename from src/lib/lttng-ust/lttng-ring-buffer-client-discard.c rename to src/common/ringbuffer-clients/discard.c index 5a6daa65..b0826fd1 100644 --- a/src/lib/lttng-ust/lttng-ring-buffer-client-discard.c +++ b/src/common/ringbuffer-clients/discard.c @@ -7,8 +7,8 @@ */ #define _LGPL_SOURCE -#include "lttng-tracer.h" -#include "lttng-rb-clients.h" +#include "common/tracer.h" +#include "common/ringbuffer-clients/clients.h" #define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_DISCARD #define RING_BUFFER_MODE_TEMPLATE_STRING "discard" @@ -20,4 +20,4 @@ lttng_ring_buffer_client_discard_exit #define LTTNG_CLIENT_TYPE LTTNG_CLIENT_DISCARD #define LTTNG_CLIENT_WAKEUP RING_BUFFER_WAKEUP_BY_WRITER -#include "lttng-ring-buffer-client-template.h" +#include "common/ringbuffer-clients/template.h" diff --git a/src/lib/lttng-ust/lttng-ring-buffer-metadata-client-template.h b/src/common/ringbuffer-clients/metadata-template.h similarity index 99% rename from src/lib/lttng-ust/lttng-ring-buffer-metadata-client-template.h rename to src/common/ringbuffer-clients/metadata-template.h index 0ffebaa1..c6d92936 100644 --- a/src/lib/lttng-ust/lttng-ring-buffer-metadata-client-template.h +++ b/src/common/ringbuffer-clients/metadata-template.h @@ -10,12 +10,13 @@ #include #include -#include "lib/lttng-ust/events.h" +#include + #include "common/bitfield.h" #include "common/align.h" -#include "lttng-tracer.h" +#include "common/events.h" +#include "common/tracer.h" #include "common/ringbuffer/frontend_types.h" -#include struct metadata_packet_header { uint32_t magic; /* 0x75D11D57 */ @@ -59,7 +60,7 @@ size_t record_header_size( } #include "common/ringbuffer/api.h" -#include "lttng-rb-clients.h" +#include "common/ringbuffer-clients/clients.h" static uint64_t client_ring_buffer_clock_read( struct lttng_ust_ring_buffer_channel *chan __attribute__((unused))) diff --git a/src/lib/lttng-ust/lttng-ring-buffer-metadata-client.c b/src/common/ringbuffer-clients/metadata.c similarity index 86% rename from src/lib/lttng-ust/lttng-ring-buffer-metadata-client.c rename to src/common/ringbuffer-clients/metadata.c index 248b8dba..24bf1038 100644 --- a/src/lib/lttng-ust/lttng-ring-buffer-metadata-client.c +++ b/src/common/ringbuffer-clients/metadata.c @@ -7,7 +7,7 @@ */ #define _LGPL_SOURCE -#include "lttng-tracer.h" +#include "common/tracer.h" #define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_DISCARD #define RING_BUFFER_MODE_TEMPLATE_STRING "metadata" @@ -16,4 +16,4 @@ #define RING_BUFFER_MODE_TEMPLATE_EXIT \ lttng_ring_buffer_metadata_client_exit #define LTTNG_CLIENT_TYPE LTTNG_CLIENT_METADATA -#include "lttng-ring-buffer-metadata-client-template.h" +#include "common/ringbuffer-clients/metadata-template.h" diff --git a/src/lib/lttng-ust/lttng-ring-buffer-client-overwrite-rt.c b/src/common/ringbuffer-clients/overwrite-rt.c similarity index 85% rename from src/lib/lttng-ust/lttng-ring-buffer-client-overwrite-rt.c rename to src/common/ringbuffer-clients/overwrite-rt.c index 8b5f6c36..48ea5154 100644 --- a/src/lib/lttng-ust/lttng-ring-buffer-client-overwrite-rt.c +++ b/src/common/ringbuffer-clients/overwrite-rt.c @@ -7,8 +7,8 @@ */ #define _LGPL_SOURCE -#include "lttng-tracer.h" -#include "lttng-rb-clients.h" +#include "common/tracer.h" +#include "common/ringbuffer-clients/clients.h" #define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_OVERWRITE #define RING_BUFFER_MODE_TEMPLATE_STRING "overwrite-rt" @@ -20,4 +20,4 @@ lttng_ring_buffer_client_overwrite_rt_exit #define LTTNG_CLIENT_TYPE LTTNG_CLIENT_OVERWRITE_RT #define LTTNG_CLIENT_WAKEUP RING_BUFFER_WAKEUP_BY_TIMER -#include "lttng-ring-buffer-client-template.h" +#include "common/ringbuffer-clients/template.h" diff --git a/src/lib/lttng-ust/lttng-ring-buffer-client-overwrite.c b/src/common/ringbuffer-clients/overwrite.c similarity index 84% rename from src/lib/lttng-ust/lttng-ring-buffer-client-overwrite.c rename to src/common/ringbuffer-clients/overwrite.c index f5d34def..63e4d756 100644 --- a/src/lib/lttng-ust/lttng-ring-buffer-client-overwrite.c +++ b/src/common/ringbuffer-clients/overwrite.c @@ -7,8 +7,8 @@ */ #define _LGPL_SOURCE -#include "lttng-tracer.h" -#include "lttng-rb-clients.h" +#include "common/tracer.h" +#include "common/ringbuffer-clients/clients.h" #define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_OVERWRITE #define RING_BUFFER_MODE_TEMPLATE_STRING "overwrite" @@ -20,4 +20,4 @@ lttng_ring_buffer_client_overwrite_exit #define LTTNG_CLIENT_TYPE LTTNG_CLIENT_OVERWRITE #define LTTNG_CLIENT_WAKEUP RING_BUFFER_WAKEUP_BY_WRITER -#include "lttng-ring-buffer-client-template.h" +#include "common/ringbuffer-clients/template.h" diff --git a/src/lib/lttng-ust/lttng-ring-buffer-client-template.h b/src/common/ringbuffer-clients/template.h similarity index 99% rename from src/lib/lttng-ust/lttng-ring-buffer-client-template.h rename to src/common/ringbuffer-clients/template.h index e4401c90..5a4aa953 100644 --- a/src/lib/lttng-ust/lttng-ring-buffer-client-template.h +++ b/src/common/ringbuffer-clients/template.h @@ -10,15 +10,14 @@ #include #include -#include "lib/lttng-ust/events.h" #include +#include + +#include "common/events.h" #include "common/bitfield.h" #include "common/align.h" #include "common/clock.h" -#include "context-internal.h" -#include "lttng-tracer.h" #include "common/ringbuffer/frontend_types.h" -#include #define LTTNG_COMPACT_EVENT_BITS 5 #define LTTNG_COMPACT_TSC_BITS 27 @@ -197,7 +196,7 @@ size_t record_header_size( } #include "common/ringbuffer/api.h" -#include "lttng-rb-clients.h" +#include "common/ringbuffer-clients/clients.h" static void lttng_write_event_header_slow(const struct lttng_ust_ring_buffer_config *config, diff --git a/src/common/tracer.h b/src/common/tracer.h new file mode 100644 index 00000000..2affd6ab --- /dev/null +++ b/src/common/tracer.h @@ -0,0 +1,84 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (C) 2005-2011 Mathieu Desnoyers + * + * This contains the definitions for the Linux Trace Toolkit tracer. + * + * Ported to userspace by Pierre-Marc Fournier. + */ + +#ifndef _UST_COMMON_TRACER_H +#define _UST_COMMON_TRACER_H + +#include + +#include "common/events.h" + +/* Tracer properties */ +#define CTF_MAGIC_NUMBER 0xC1FC1FC1 +#define TSDL_MAGIC_NUMBER 0x75D11D57 + +/* CTF specification version followed */ +#define CTF_SPEC_MAJOR 1 +#define CTF_SPEC_MINOR 8 + +#define LTTNG_RFLAG_EXTENDED RING_BUFFER_RFLAG_END +#define LTTNG_RFLAG_END (LTTNG_RFLAG_EXTENDED << 1) + +/* + * LTTng client type enumeration. Used by the consumer to map the + * callbacks from its own address space. + */ +enum lttng_client_types { + LTTNG_CLIENT_METADATA = 0, + LTTNG_CLIENT_DISCARD = 1, + LTTNG_CLIENT_OVERWRITE = 2, + LTTNG_CLIENT_DISCARD_RT = 3, + LTTNG_CLIENT_OVERWRITE_RT = 4, + LTTNG_NR_CLIENT_TYPES, +}; + +struct lttng_transport *lttng_ust_transport_find(const char *name) + __attribute__((visibility("hidden"))); + +void lttng_transport_register(struct lttng_transport *transport) + __attribute__((visibility("hidden"))); + +void lttng_transport_unregister(struct lttng_transport *transport) + __attribute__((visibility("hidden"))); + + +struct lttng_counter_transport *lttng_counter_transport_find(const char *name) + __attribute__((visibility("hidden"))); + +void lttng_counter_transport_register(struct lttng_counter_transport *transport) + __attribute__((visibility("hidden"))); + +void lttng_counter_transport_unregister(struct lttng_counter_transport *transport) + __attribute__((visibility("hidden"))); + + +size_t lttng_ust_dummy_get_size(void *priv, struct lttng_ust_probe_ctx *probe_ctx, + size_t offset) + __attribute__((visibility("hidden"))); + +void lttng_ust_dummy_record(void *priv, struct lttng_ust_probe_ctx *probe_ctx, + struct lttng_ust_ring_buffer_ctx *ctx, + struct lttng_ust_channel_buffer *chan) + __attribute__((visibility("hidden"))); + +void lttng_ust_dummy_get_value(void *priv, struct lttng_ust_probe_ctx *probe_ctx, + struct lttng_ust_ctx_value *value) + __attribute__((visibility("hidden"))); + +int lttng_context_is_app(const char *name) + __attribute__((visibility("hidden"))); + +struct lttng_ust_channel_buffer *lttng_ust_alloc_channel_buffer(void) + __attribute__((visibility("hidden"))); + +void lttng_ust_free_channel_common(struct lttng_ust_channel_common *chan) + __attribute__((visibility("hidden"))); + +#endif /* _UST_COMMON_TRACER_H */ diff --git a/src/lib/lttng-ust-ctl/Makefile.am b/src/lib/lttng-ust-ctl/Makefile.am index 807d8fa6..5afbfb3e 100644 --- a/src/lib/lttng-ust-ctl/Makefile.am +++ b/src/lib/lttng-ust-ctl/Makefile.am @@ -10,7 +10,10 @@ liblttng_ust_ctl_la_LDFLAGS = \ liblttng_ust_ctl_la_LIBADD = \ $(top_builddir)/src/lib/lttng-ust-common/liblttng-ust-common.la \ - $(top_builddir)/src/lib/lttng-ust/liblttng-ust-support.la \ + $(top_builddir)/src/common/libringbuffer.la \ + $(top_builddir)/src/common/libringbuffer-clients.la \ + $(top_builddir)/src/common/libcounter.la \ + $(top_builddir)/src/common/libcounter-clients.la \ $(top_builddir)/src/common/libustcomm.la \ $(top_builddir)/src/common/libcommon.la \ $(DL_LIBS) diff --git a/src/lib/lttng-ust-ctl/ustctl.c b/src/lib/lttng-ust-ctl/ustctl.c index 86e37f18..4631a1e0 100644 --- a/src/lib/lttng-ust-ctl/ustctl.c +++ b/src/lib/lttng-ust-ctl/ustctl.c @@ -27,10 +27,10 @@ #include "common/ringbuffer/frontend.h" #include "common/events.h" #include "common/wait.h" -#include "lib/lttng-ust/lttng-rb-clients.h" +#include "common/ringbuffer-clients/clients.h" #include "common/getenv.h" -#include "lib/lttng-ust/lttng-tracer-core.h" -#include "lib/lttng-ust/lttng-counter-client.h" +#include "common/tracer.h" +#include "common/counter-clients/clients.h" #include "common/smp.h" #include "common/counter/counter.h" diff --git a/src/lib/lttng-ust/Makefile.am b/src/lib/lttng-ust/Makefile.am index b101a81e..a1f8603e 100644 --- a/src/lib/lttng-ust/Makefile.am +++ b/src/lib/lttng-ust/Makefile.am @@ -4,11 +4,7 @@ AM_CFLAGS += -I$(srcdir) lib_LTLIBRARIES = liblttng-ust.la -noinst_LTLIBRARIES = \ - liblttng-ust-runtime.la \ - liblttng-ust-support.la - -liblttng_ust_runtime_la_SOURCES = \ +liblttng_ust_la_SOURCES = \ bytecode.h \ lttng-ust-comm.c \ lttng-ust-abi.c \ @@ -62,45 +58,27 @@ liblttng_ust_runtime_la_SOURCES = \ rculfhash-mm-chunk.c \ rculfhash-mm-mmap.c \ rculfhash-mm-order.c \ - strerror.c + strerror.c \ + lttng-tracer-core.h if HAVE_PERF_EVENT -liblttng_ust_runtime_la_SOURCES += \ +liblttng_ust_la_SOURCES += \ lttng-context-perf-counters.c \ perf_event.h endif -liblttng_ust_support_la_SOURCES = \ - lttng-tracer.h \ - lttng-tracer-core.h \ - ust-core.c \ - lttng-rb-clients.h \ - lttng-ring-buffer-client-template.h \ - lttng-ring-buffer-client-discard.c \ - lttng-ring-buffer-client-discard-rt.c \ - lttng-ring-buffer-client-overwrite.c \ - lttng-ring-buffer-client-overwrite-rt.c \ - lttng-ring-buffer-metadata-client-template.h \ - lttng-ring-buffer-metadata-client.c \ - lttng-counter-client.h \ - lttng-counter-client-percpu-32-modular.c \ - lttng-counter-client-percpu-64-modular.c - -liblttng_ust_la_SOURCES = - liblttng_ust_la_LDFLAGS = -no-undefined -version-info $(LTTNG_UST_LIBRARY_VERSION) -liblttng_ust_support_la_LIBADD = \ - $(top_builddir)/src/common/libringbuffer.la \ - $(top_builddir)/src/common/libcounter.la - liblttng_ust_la_LIBADD = \ - -lrt \ - $(top_builddir)/src/lib/lttng-ust-common/liblttng-ust-common.la \ + $(top_builddir)/src/common/libringbuffer.la \ + $(top_builddir)/src/common/libringbuffer-clients.la \ + $(top_builddir)/src/common/libcounter.la \ + $(top_builddir)/src/common/libcounter-clients.la \ $(top_builddir)/src/common/libustcomm.la \ $(top_builddir)/src/common/libcommon.la \ + $(top_builddir)/src/lib/lttng-ust-common/liblttng-ust-common.la \ $(top_builddir)/src/lib/lttng-ust-tracepoint/liblttng-ust-tracepoint.la \ - liblttng-ust-runtime.la liblttng-ust-support.la \ + -lrt \ $(DL_LIBS) liblttng_ust_la_CFLAGS = -DUST_COMPONENT="liblttng_ust" $(AM_CFLAGS) diff --git a/src/lib/lttng-ust/context-internal.h b/src/lib/lttng-ust/context-internal.h index 874b6d73..bacb90b4 100644 --- a/src/lib/lttng-ust/context-internal.h +++ b/src/lib/lttng-ust/context-internal.h @@ -36,9 +36,6 @@ int lttng_ust_context_append(struct lttng_ust_ctx **ctx_p, const struct lttng_ust_ctx_field *f) __attribute__((visibility("hidden"))); -int lttng_context_is_app(const char *name) - __attribute__((visibility("hidden"))); - void lttng_context_vtid_reset(void) __attribute__((visibility("hidden"))); diff --git a/src/lib/lttng-ust/events.h b/src/lib/lttng-ust/events.h index d928a0e1..3ef0dbcb 100644 --- a/src/lib/lttng-ust/events.h +++ b/src/lib/lttng-ust/events.h @@ -261,12 +261,6 @@ int lttng_channel_enable(struct lttng_ust_channel_common *lttng_channel) int lttng_channel_disable(struct lttng_ust_channel_common *lttng_channel) __attribute__((visibility("hidden"))); -void lttng_transport_register(struct lttng_transport *transport) - __attribute__((visibility("hidden"))); - -void lttng_transport_unregister(struct lttng_transport *transport) - __attribute__((visibility("hidden"))); - void lttng_probe_provider_unregister_events(const struct lttng_ust_probe_desc *desc) __attribute__((visibility("hidden"))); @@ -294,12 +288,6 @@ void lttng_ust_abi_events_exit(void) void lttng_ust_abi_objd_table_owner_cleanup(void *owner) __attribute__((visibility("hidden"))); -struct lttng_ust_channel_buffer *lttng_ust_alloc_channel_buffer(void) - __attribute__((visibility("hidden"))); - -void lttng_ust_free_channel_common(struct lttng_ust_channel_common *chan) - __attribute__((visibility("hidden"))); - int lttng_ust_interpret_event_filter(const struct lttng_ust_event_common *event, const char *interpreter_stack_data, struct lttng_ust_probe_ctx *probe_ctx, diff --git a/src/lib/lttng-ust/lttng-bytecode-specialize.c b/src/lib/lttng-ust/lttng-bytecode-specialize.c index bf7af5d5..e57892f2 100644 --- a/src/lib/lttng-ust/lttng-bytecode-specialize.c +++ b/src/lib/lttng-ust/lttng-bytecode-specialize.c @@ -17,6 +17,7 @@ #include "lttng-bytecode.h" #include "lib/lttng-ust/events.h" #include "common/macros.h" +#include "common/tracer.h" static int lttng_fls(int val) { diff --git a/src/lib/lttng-ust/lttng-bytecode.c b/src/lib/lttng-ust/lttng-bytecode.c index 9222e1cc..33d50db6 100644 --- a/src/lib/lttng-ust/lttng-bytecode.c +++ b/src/lib/lttng-ust/lttng-bytecode.c @@ -16,6 +16,7 @@ #include "lttng-bytecode.h" #include "lib/lttng-ust/events.h" #include "common/macros.h" +#include "common/tracer.h" static const char *opnames[] = { [ BYTECODE_OP_UNKNOWN ] = "UNKNOWN", diff --git a/src/lib/lttng-ust/lttng-context-provider.c b/src/lib/lttng-ust/lttng-context-provider.c index 796a6b49..8ef552a2 100644 --- a/src/lib/lttng-ust/lttng-context-provider.c +++ b/src/lib/lttng-ust/lttng-context-provider.c @@ -19,6 +19,7 @@ #include "common/jhash.h" #include "context-provider-internal.h" #include "common/macros.h" +#include "common/tracer.h" struct lttng_ust_registered_context_provider { const struct lttng_ust_context_provider *provider; diff --git a/src/lib/lttng-ust/lttng-events.c b/src/lib/lttng-ust/lttng-events.c index a8baff3a..8596b7a0 100644 --- a/src/lib/lttng-ust/lttng-events.c +++ b/src/lib/lttng-ust/lttng-events.c @@ -43,7 +43,7 @@ #include "common/tracepoint.h" #include "common/strutils.h" #include "lttng-bytecode.h" -#include "lttng-tracer.h" +#include "common/tracer.h" #include "lttng-tracer-core.h" #include "lttng-ust-statedump.h" #include "context-internal.h" diff --git a/src/lib/lttng-ust/lttng-tracer-core.h b/src/lib/lttng-ust/lttng-tracer-core.h index abe3ea74..eadc43ed 100644 --- a/src/lib/lttng-ust/lttng-tracer-core.h +++ b/src/lib/lttng-ust/lttng-tracer-core.h @@ -70,19 +70,6 @@ char* lttng_ust_sockinfo_get_procname(void *owner) void lttng_ust_sockinfo_session_enabled(void *owner) __attribute__((visibility("hidden"))); -size_t lttng_ust_dummy_get_size(void *priv, struct lttng_ust_probe_ctx *probe_ctx, - size_t offset) - __attribute__((visibility("hidden"))); - -void lttng_ust_dummy_record(void *priv, struct lttng_ust_probe_ctx *probe_ctx, - struct lttng_ust_ring_buffer_ctx *ctx, - struct lttng_ust_channel_buffer *chan) - __attribute__((visibility("hidden"))); - -void lttng_ust_dummy_get_value(void *priv, struct lttng_ust_probe_ctx *probe_ctx, - struct lttng_ust_ctx_value *value) - __attribute__((visibility("hidden"))); - void lttng_event_notifier_notification_send( const struct lttng_ust_event_notifier *event_notifier, const char *stack_data, @@ -90,15 +77,6 @@ void lttng_event_notifier_notification_send( struct lttng_ust_notification_ctx *notif_ctx) __attribute__((visibility("hidden"))); -struct lttng_counter_transport *lttng_counter_transport_find(const char *name) - __attribute__((visibility("hidden"))); - -void lttng_counter_transport_register(struct lttng_counter_transport *transport) - __attribute__((visibility("hidden"))); - -void lttng_counter_transport_unregister(struct lttng_counter_transport *transport) - __attribute__((visibility("hidden"))); - #ifdef HAVE_LINUX_PERF_EVENT_H void lttng_ust_perf_counter_alloc_tls(void) __attribute__((visibility("hidden"))); diff --git a/src/lib/lttng-ust/lttng-tracer.h b/src/lib/lttng-ust/lttng-tracer.h deleted file mode 100644 index 69d998a1..00000000 --- a/src/lib/lttng-ust/lttng-tracer.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SPDX-License-Identifier: LGPL-2.1-only - * - * Copyright (C) 2005-2011 Mathieu Desnoyers - * - * This contains the definitions for the Linux Trace Toolkit tracer. - * - * Ported to userspace by Pierre-Marc Fournier. - */ - -#ifndef _LTTNG_TRACER_H -#define _LTTNG_TRACER_H - -#include -#include -#include -#include "lttng-tracer-core.h" - -/* Tracer properties */ -#define CTF_MAGIC_NUMBER 0xC1FC1FC1 -#define TSDL_MAGIC_NUMBER 0x75D11D57 - -/* CTF specification version followed */ -#define CTF_SPEC_MAJOR 1 -#define CTF_SPEC_MINOR 8 - -#define LTTNG_RFLAG_EXTENDED RING_BUFFER_RFLAG_END -#define LTTNG_RFLAG_END (LTTNG_RFLAG_EXTENDED << 1) - -/* - * LTTng client type enumeration. Used by the consumer to map the - * callbacks from its own address space. - */ -enum lttng_client_types { - LTTNG_CLIENT_METADATA = 0, - LTTNG_CLIENT_DISCARD = 1, - LTTNG_CLIENT_OVERWRITE = 2, - LTTNG_CLIENT_DISCARD_RT = 3, - LTTNG_CLIENT_OVERWRITE_RT = 4, - LTTNG_NR_CLIENT_TYPES, -}; - -#endif /* _LTTNG_TRACER_H */ diff --git a/src/lib/lttng-ust/lttng-ust-abi.c b/src/lib/lttng-ust/lttng-ust-abi.c index 70445a19..2a8b8c09 100644 --- a/src/lib/lttng-ust/lttng-ust-abi.c +++ b/src/lib/lttng-ust/lttng-ust-abi.c @@ -44,9 +44,10 @@ #include "common/ringbuffer/shm.h" #include "common/counter/counter.h" #include "common/tracepoint.h" -#include "lttng-tracer.h" +#include "common/tracer.h" #include "common/strutils.h" #include "lib/lttng-ust/events.h" +#include "lib/lttng-ust/lttng-tracer-core.h" #include "context-internal.h" #include "common/macros.h" diff --git a/src/lib/lttng-ust/lttng-ust-comm.c b/src/lib/lttng-ust/lttng-ust-comm.c index ff7b5939..323ccaea 100644 --- a/src/lib/lttng-ust/lttng-ust-comm.c +++ b/src/lib/lttng-ust/lttng-ust-comm.c @@ -55,8 +55,8 @@ #include "lib/lttng-ust/events.h" #include "context-internal.h" #include "common/align.h" -#include "lttng-counter-client.h" -#include "lttng-rb-clients.h" +#include "common/counter-clients/clients.h" +#include "common/ringbuffer-clients/clients.h" /* * Has lttng ust comm constructor been called ? -- 2.34.1