From e7bc0ef6c86ae97886cf5f8b28854cf281d4962b Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 18 Mar 2021 11:44:30 -0400 Subject: [PATCH] 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 Change-Id: I6acec4e4ffff721e6ea5698e64a063045e1c1022 --- include/lttng/ust-events.h | 67 ++++++++++----- include/lttng/ust-tracepoint-event.h | 13 +-- include/ust-context-provider.h | 8 +- liblttng-ust-ctl/ustctl.c | 30 +++---- liblttng-ust/context-provider-internal.h | 2 +- liblttng-ust/lttng-context-cgroup-ns.c | 2 +- liblttng-ust/lttng-context-cpu-id.c | 2 +- liblttng-ust/lttng-context-ip.c | 2 +- liblttng-ust/lttng-context-ipc-ns.c | 2 +- liblttng-ust/lttng-context-mnt-ns.c | 2 +- liblttng-ust/lttng-context-net-ns.c | 2 +- liblttng-ust/lttng-context-perf-counters.c | 2 +- liblttng-ust/lttng-context-pid-ns.c | 2 +- liblttng-ust/lttng-context-procname.c | 2 +- liblttng-ust/lttng-context-pthread-id.c | 2 +- liblttng-ust/lttng-context-time-ns.c | 2 +- liblttng-ust/lttng-context-user-ns.c | 2 +- liblttng-ust/lttng-context-uts-ns.c | 2 +- liblttng-ust/lttng-context-vegid.c | 2 +- liblttng-ust/lttng-context-veuid.c | 2 +- liblttng-ust/lttng-context-vgid.c | 2 +- liblttng-ust/lttng-context-vpid.c | 2 +- liblttng-ust/lttng-context-vsgid.c | 2 +- liblttng-ust/lttng-context-vsuid.c | 2 +- liblttng-ust/lttng-context-vtid.c | 2 +- liblttng-ust/lttng-context-vuid.c | 2 +- liblttng-ust/lttng-context.c | 2 +- liblttng-ust/lttng-events.c | 76 ++++++++--------- liblttng-ust/lttng-ring-buffer-client.h | 56 ++++++------- .../lttng-ring-buffer-metadata-client.h | 36 ++++----- liblttng-ust/lttng-tracer-core.h | 6 +- liblttng-ust/lttng-ust-abi.c | 81 ++++++++++--------- liblttng-ust/ust-core.c | 55 ++++++++++++- liblttng-ust/ust-events-internal.h | 49 +++++++---- tests/compile/test-app-ctx/hello.c | 26 +++--- 35 files changed, 324 insertions(+), 225 deletions(-) diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index 59446c4b..4ef3301c 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -36,7 +36,7 @@ extern "C" { #define LTTNG_UST_PROVIDER_MAJOR 2 #define LTTNG_UST_PROVIDER_MINOR 0 -struct lttng_channel; +struct lttng_ust_channel_buffer; struct lttng_ust_session; struct lttng_ust_lib_ring_buffer_ctx; struct lttng_ust_event_field; @@ -405,7 +405,7 @@ struct lttng_ust_event_recorder { struct lttng_ust_event_recorder_private *priv; /* Private event record interface */ unsigned int id; - struct lttng_channel *chan; + struct lttng_ust_channel_buffer *chan; struct lttng_ust_ctx *ctx; /* End of base ABI. Fields below should be used after checking struct_size. */ @@ -441,7 +441,6 @@ struct lttng_ust_event_notifier { }; struct lttng_ust_lib_ring_buffer_channel; -struct lttng_ust_shm_handle; struct lttng_ust_channel_ops_private; /* @@ -469,34 +468,58 @@ struct lttng_ust_channel_ops { /* End of base ABI. Fields below should be used after checking struct_size. */ }; +enum lttng_ust_channel_type { + LTTNG_UST_CHANNEL_TYPE_BUFFER = 0, +}; + +struct lttng_ust_channel_common_private; + /* * IMPORTANT: this structure is part of the ABI between the probe and * UST. Fields need to be only added at the end, never reordered, never * removed. + * + * The field @struct_size should be used to determine the size of the + * structure. It should be queried before using additional fields added + * at the end of the structure. */ -struct lttng_channel { - /* - * The pointers located in this private data are NOT safe to be - * dereferenced by the consumer. The only operations the - * consumer process is designed to be allowed to do is to read - * and perform subbuffer flush. - */ - struct lttng_ust_lib_ring_buffer_channel *chan; /* Channel buffers */ +struct lttng_ust_channel_common { + uint32_t struct_size; /* Size of this structure. */ + + struct lttng_ust_channel_common_private *priv; /* Private channel interface */ + + enum lttng_ust_channel_type type; + void *child; /* Pointer to child, for inheritance by aggregation. */ + int enabled; - struct lttng_ust_ctx *ctx; - /* Event ID management */ struct lttng_ust_session *session; - int objd; /* Object associated to channel */ - struct cds_list_head node; /* Channel list in session */ + + /* End of base ABI. Fields below should be used after checking struct_size. */ +}; + +struct lttng_ust_channel_buffer_private; + +/* + * IMPORTANT: this structure is part of the ABI between the probe and + * UST. Fields need to be only added at the end, never reordered, never + * removed. + * + * The field @struct_size should be used to determine the size of the + * structure. It should be queried before using additional fields added + * at the end of the structure. + */ +struct lttng_ust_channel_buffer { + uint32_t struct_size; /* Size of this structure. */ + + struct lttng_ust_channel_common *parent; /* Inheritance by aggregation. */ + struct lttng_ust_channel_buffer_private *priv; /* Private channel buffer interface */ + + struct lttng_ust_ctx *ctx; struct lttng_ust_channel_ops *ops; - int header_type; /* 0: unset, 1: compact, 2: large */ - struct lttng_ust_shm_handle *handle; /* shared-memory handle */ + struct lttng_ust_lib_ring_buffer_channel *chan; /* Channel buffers */ + struct lttng_ust_shm_handle *handle; /* shared-memory handle */ - /* Channel ID */ - unsigned int id; - enum lttng_ust_abi_chan_type type; - unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */ - int tstate:1; /* Transient enable state */ + /* End of base ABI. Fields below should be used after checking struct_size. */ }; /* diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index 33aa8d2d..9bf4eead 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -803,13 +803,14 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \ case LTTNG_UST_EVENT_TYPE_RECORDER: \ { \ struct lttng_ust_event_recorder *__event_recorder = (struct lttng_ust_event_recorder *) __event->child; \ - struct lttng_channel *__chan = __event_recorder->chan; \ + struct lttng_ust_channel_buffer *__chan = __event_recorder->chan; \ + struct lttng_ust_channel_common *__chan_common = __chan->parent; \ \ - if (!_TP_SESSION_CHECK(session, __chan->session)) \ + if (!_TP_SESSION_CHECK(session, __chan_common->session)) \ return; \ - if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->session->active))) \ + if (caa_unlikely(!CMM_ACCESS_ONCE(__chan_common->session->active))) \ return; \ - if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->enabled))) \ + if (caa_unlikely(!CMM_ACCESS_ONCE(__chan_common->enabled))) \ return; \ break; \ } \ @@ -841,7 +842,7 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \ { \ size_t __event_len, __event_align; \ struct lttng_ust_event_recorder *__event_recorder = (struct lttng_ust_event_recorder *) __event->child; \ - struct lttng_channel *__chan = __event_recorder->chan; \ + struct lttng_ust_channel_buffer *__chan = __event_recorder->chan; \ struct lttng_ust_lib_ring_buffer_ctx __ctx; \ struct lttng_ust_stack_ctx __lttng_ctx; \ \ @@ -851,7 +852,7 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \ memset(&__lttng_ctx, 0, sizeof(__lttng_ctx)); \ __lttng_ctx.struct_size = sizeof(struct lttng_ust_stack_ctx); \ __lttng_ctx.event_recorder = __event_recorder; \ - __lttng_ctx.chan_ctx = tp_rcu_dereference(__chan->ctx); \ + __lttng_ctx.chan_ctx = tp_rcu_dereference(__chan->ctx); \ __lttng_ctx.event_ctx = tp_rcu_dereference(__event_recorder->ctx); \ lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_ctx, __event_len, \ __event_align, -1, __chan->handle); \ diff --git a/include/ust-context-provider.h b/include/ust-context-provider.h index 637bc0c2..094e9fd9 100644 --- a/include/ust-context-provider.h +++ b/include/ust-context-provider.h @@ -57,7 +57,7 @@ struct lttng_ust_ctx_field { size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset); void (*record)(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan); + struct lttng_ust_channel_buffer *chan); void (*get_value)(struct lttng_ust_ctx_field *field, struct lttng_ust_ctx_value *value); void (*destroy)(struct lttng_ust_ctx_field *field); @@ -107,7 +107,7 @@ struct lttng_ust_context_provider { size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset); void (*record)(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan); + struct lttng_ust_channel_buffer *chan); void (*get_value)(struct lttng_ust_ctx_field *field, struct lttng_ust_ctx_value *value); struct cds_hlist_node node; @@ -122,7 +122,7 @@ void lttng_ust_context_set_session_provider(const char *name, size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset), void (*record)(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan), + struct lttng_ust_channel_buffer *chan), void (*get_value)(struct lttng_ust_ctx_field *field, struct lttng_ust_ctx_value *value)); @@ -132,7 +132,7 @@ int lttng_ust_context_set_provider_rcu(struct lttng_ust_ctx **_ctx, size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset), void (*record)(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan), + struct lttng_ust_channel_buffer *chan), void (*get_value)(struct lttng_ust_ctx_field *field, struct lttng_ust_ctx_value *value)); diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index adf23af6..a4a3313a 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -45,7 +45,7 @@ * Channel representation within consumer. */ struct ustctl_consumer_channel { - struct lttng_channel *chan; /* lttng channel buffers */ + struct lttng_ust_channel_buffer *chan; /* lttng channel buffers */ /* initial attributes */ struct ustctl_consumer_channel_attr attr; @@ -1344,17 +1344,17 @@ int ustctl_write_metadata_to_channel( size_t len) /* metadata length */ { struct lttng_ust_lib_ring_buffer_ctx ctx; - struct lttng_channel *chan = channel->chan; + struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan; const char *str = metadata_str; int ret = 0, waitret; size_t reserve_len, pos; for (pos = 0; pos < len; pos += reserve_len) { reserve_len = min_t(size_t, - chan->ops->priv->packet_avail_size(chan->chan, chan->handle), + lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan, lttng_chan_buf->handle), len - pos); - lib_ring_buffer_ctx_init(&ctx, chan->chan, NULL, reserve_len, - sizeof(char), -1, chan->handle); + lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, + sizeof(char), -1, lttng_chan_buf->handle); /* * We don't care about metadata buffer's records lost * count, because we always retry here. Report error if @@ -1363,7 +1363,7 @@ int ustctl_write_metadata_to_channel( */ waitret = wait_cond_interruptible_timeout( ({ - ret = chan->ops->event_reserve(&ctx, 0); + ret = lttng_chan_buf->ops->event_reserve(&ctx, 0); ret != -ENOBUFS || !ret; }), LTTNG_METADATA_TIMEOUT_MSEC); @@ -1375,8 +1375,8 @@ int ustctl_write_metadata_to_channel( ret = waitret; goto end; } - chan->ops->event_write(&ctx, &str[pos], reserve_len); - chan->ops->event_commit(&ctx); + lttng_chan_buf->ops->event_write(&ctx, &str[pos], reserve_len); + lttng_chan_buf->ops->event_commit(&ctx); } end: return ret; @@ -1392,25 +1392,25 @@ ssize_t ustctl_write_one_packet_to_channel( size_t len) /* metadata length */ { struct lttng_ust_lib_ring_buffer_ctx ctx; - struct lttng_channel *chan = channel->chan; + struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan; const char *str = metadata_str; ssize_t reserve_len; int ret; reserve_len = min_t(ssize_t, - chan->ops->priv->packet_avail_size(chan->chan, chan->handle), + lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan, lttng_chan_buf->handle), len); - lib_ring_buffer_ctx_init(&ctx, chan->chan, NULL, reserve_len, - sizeof(char), -1, chan->handle); - ret = chan->ops->event_reserve(&ctx, 0); + lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, + sizeof(char), -1, lttng_chan_buf->handle); + ret = lttng_chan_buf->ops->event_reserve(&ctx, 0); if (ret != 0) { DBG("LTTng: event reservation failed"); assert(ret < 0); reserve_len = ret; goto end; } - chan->ops->event_write(&ctx, str, reserve_len); - chan->ops->event_commit(&ctx); + lttng_chan_buf->ops->event_write(&ctx, str, reserve_len); + lttng_chan_buf->ops->event_commit(&ctx); end: return reserve_len; diff --git a/liblttng-ust/context-provider-internal.h b/liblttng-ust/context-provider-internal.h index 96343d90..1454b397 100644 --- a/liblttng-ust/context-provider-internal.h +++ b/liblttng-ust/context-provider-internal.h @@ -15,7 +15,7 @@ void lttng_ust_context_set_event_notifier_group_provider(const char *name, size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset), void (*record)(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan), + struct lttng_ust_channel_buffer *chan), void (*get_value)(struct lttng_ust_ctx_field *field, struct lttng_ust_ctx_value *value)); diff --git a/liblttng-ust/lttng-context-cgroup-ns.c b/liblttng-ust/lttng-context-cgroup-ns.c index 65c5306c..8d32cdb4 100644 --- a/liblttng-ust/lttng-context-cgroup-ns.c +++ b/liblttng-ust/lttng-context-cgroup-ns.c @@ -102,7 +102,7 @@ size_t cgroup_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void cgroup_ns_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { ino_t cgroup_ns; diff --git a/liblttng-ust/lttng-context-cpu-id.c b/liblttng-ust/lttng-context-cpu-id.c index 9c553828..a3fdb9c6 100644 --- a/liblttng-ust/lttng-context-cpu-id.c +++ b/liblttng-ust/lttng-context-cpu-id.c @@ -36,7 +36,7 @@ size_t cpu_id_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void cpu_id_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { int cpu; diff --git a/liblttng-ust/lttng-context-ip.c b/liblttng-ust/lttng-context-ip.c index d7a65905..b56e0db1 100644 --- a/liblttng-ust/lttng-context-ip.c +++ b/liblttng-ust/lttng-context-ip.c @@ -29,7 +29,7 @@ size_t ip_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void ip_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { void *ip; diff --git a/liblttng-ust/lttng-context-ipc-ns.c b/liblttng-ust/lttng-context-ipc-ns.c index b2c5e27d..30a9c599 100644 --- a/liblttng-ust/lttng-context-ipc-ns.c +++ b/liblttng-ust/lttng-context-ipc-ns.c @@ -101,7 +101,7 @@ size_t ipc_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void ipc_ns_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { ino_t ipc_ns; diff --git a/liblttng-ust/lttng-context-mnt-ns.c b/liblttng-ust/lttng-context-mnt-ns.c index 2606ff3c..60c48057 100644 --- a/liblttng-ust/lttng-context-mnt-ns.c +++ b/liblttng-ust/lttng-context-mnt-ns.c @@ -84,7 +84,7 @@ size_t mnt_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void mnt_ns_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { ino_t mnt_ns; diff --git a/liblttng-ust/lttng-context-net-ns.c b/liblttng-ust/lttng-context-net-ns.c index 1512fc27..d9293a6b 100644 --- a/liblttng-ust/lttng-context-net-ns.c +++ b/liblttng-ust/lttng-context-net-ns.c @@ -101,7 +101,7 @@ size_t net_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void net_ns_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { ino_t net_ns; diff --git a/liblttng-ust/lttng-context-perf-counters.c b/liblttng-ust/lttng-context-perf-counters.c index f8241c39..59393084 100644 --- a/liblttng-ust/lttng-context-perf-counters.c +++ b/liblttng-ust/lttng-context-perf-counters.c @@ -438,7 +438,7 @@ uint64_t wrapper_perf_counter_read(struct lttng_ust_ctx_field *field) static void perf_counter_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { uint64_t value; diff --git a/liblttng-ust/lttng-context-pid-ns.c b/liblttng-ust/lttng-context-pid-ns.c index 1c45d7f2..25210e92 100644 --- a/liblttng-ust/lttng-context-pid-ns.c +++ b/liblttng-ust/lttng-context-pid-ns.c @@ -87,7 +87,7 @@ size_t pid_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void pid_ns_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { ino_t pid_ns; diff --git a/liblttng-ust/lttng-context-procname.c b/liblttng-ust/lttng-context-procname.c index 1221298e..00a79355 100644 --- a/liblttng-ust/lttng-context-procname.c +++ b/liblttng-ust/lttng-context-procname.c @@ -73,7 +73,7 @@ size_t procname_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void procname_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { char *procname; diff --git a/liblttng-ust/lttng-context-pthread-id.c b/liblttng-ust/lttng-context-pthread-id.c index b25dc7ae..59a6f381 100644 --- a/liblttng-ust/lttng-context-pthread-id.c +++ b/liblttng-ust/lttng-context-pthread-id.c @@ -28,7 +28,7 @@ size_t pthread_id_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void pthread_id_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { unsigned long pthread_id; diff --git a/liblttng-ust/lttng-context-time-ns.c b/liblttng-ust/lttng-context-time-ns.c index 6534ce72..fa85b5da 100644 --- a/liblttng-ust/lttng-context-time-ns.c +++ b/liblttng-ust/lttng-context-time-ns.c @@ -100,7 +100,7 @@ size_t time_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void time_ns_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { ino_t time_ns; diff --git a/liblttng-ust/lttng-context-user-ns.c b/liblttng-ust/lttng-context-user-ns.c index ee1cf739..e4bb1dd2 100644 --- a/liblttng-ust/lttng-context-user-ns.c +++ b/liblttng-ust/lttng-context-user-ns.c @@ -84,7 +84,7 @@ size_t user_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void user_ns_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { ino_t user_ns; diff --git a/liblttng-ust/lttng-context-uts-ns.c b/liblttng-ust/lttng-context-uts-ns.c index e22011c9..3037d084 100644 --- a/liblttng-ust/lttng-context-uts-ns.c +++ b/liblttng-ust/lttng-context-uts-ns.c @@ -102,7 +102,7 @@ size_t uts_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void uts_ns_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { ino_t uts_ns; diff --git a/liblttng-ust/lttng-context-vegid.c b/liblttng-ust/lttng-context-vegid.c index 488bfdd8..ca0555e3 100644 --- a/liblttng-ust/lttng-context-vegid.c +++ b/liblttng-ust/lttng-context-vegid.c @@ -73,7 +73,7 @@ size_t vegid_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void vegid_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { gid_t vegid; diff --git a/liblttng-ust/lttng-context-veuid.c b/liblttng-ust/lttng-context-veuid.c index 22c09c82..8cd29ace 100644 --- a/liblttng-ust/lttng-context-veuid.c +++ b/liblttng-ust/lttng-context-veuid.c @@ -73,7 +73,7 @@ size_t veuid_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void veuid_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { uid_t veuid; diff --git a/liblttng-ust/lttng-context-vgid.c b/liblttng-ust/lttng-context-vgid.c index a7b5dbfd..7536d382 100644 --- a/liblttng-ust/lttng-context-vgid.c +++ b/liblttng-ust/lttng-context-vgid.c @@ -73,7 +73,7 @@ size_t vgid_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void vgid_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { gid_t vgid; diff --git a/liblttng-ust/lttng-context-vpid.c b/liblttng-ust/lttng-context-vpid.c index 3594e529..0c532ddf 100644 --- a/liblttng-ust/lttng-context-vpid.c +++ b/liblttng-ust/lttng-context-vpid.c @@ -57,7 +57,7 @@ size_t vpid_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void vpid_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { pid_t vpid = wrapper_getvpid(); diff --git a/liblttng-ust/lttng-context-vsgid.c b/liblttng-ust/lttng-context-vsgid.c index f49d7f79..a63c1901 100644 --- a/liblttng-ust/lttng-context-vsgid.c +++ b/liblttng-ust/lttng-context-vsgid.c @@ -77,7 +77,7 @@ size_t vsgid_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void vsgid_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { gid_t vsgid; diff --git a/liblttng-ust/lttng-context-vsuid.c b/liblttng-ust/lttng-context-vsuid.c index aa8f755e..3413c3a9 100644 --- a/liblttng-ust/lttng-context-vsuid.c +++ b/liblttng-ust/lttng-context-vsuid.c @@ -77,7 +77,7 @@ size_t vsuid_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void vsuid_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { uid_t vsuid; diff --git a/liblttng-ust/lttng-context-vtid.c b/liblttng-ust/lttng-context-vtid.c index 543e0498..1648d8db 100644 --- a/liblttng-ust/lttng-context-vtid.c +++ b/liblttng-ust/lttng-context-vtid.c @@ -61,7 +61,7 @@ pid_t wrapper_getvtid(void) static void vtid_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { pid_t vtid = wrapper_getvtid(); diff --git a/liblttng-ust/lttng-context-vuid.c b/liblttng-ust/lttng-context-vuid.c index 438b4222..b2edf870 100644 --- a/liblttng-ust/lttng-context-vuid.c +++ b/liblttng-ust/lttng-context-vuid.c @@ -73,7 +73,7 @@ size_t vuid_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void vuid_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { uid_t vuid; diff --git a/liblttng-ust/lttng-context.c b/liblttng-ust/lttng-context.c index e97b688a..8bc99987 100644 --- a/liblttng-ust/lttng-context.c +++ b/liblttng-ust/lttng-context.c @@ -296,7 +296,7 @@ int lttng_ust_context_set_provider_rcu(struct lttng_ust_ctx **_ctx, size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset), void (*record)(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan), + struct lttng_ust_channel_buffer *chan), void (*get_value)(struct lttng_ust_ctx_field *field, struct lttng_ust_ctx_value *value)) { diff --git a/liblttng-ust/lttng-events.c b/liblttng-ust/lttng-events.c index d5fd9fee..9c1a9da1 100644 --- a/liblttng-ust/lttng-events.c +++ b/liblttng-ust/lttng-events.c @@ -230,16 +230,18 @@ struct lttng_event_notifier_group *lttng_event_notifier_group_create(void) * Only used internally at session destruction. */ static -void _lttng_channel_unmap(struct lttng_channel *lttng_chan) +void _lttng_channel_unmap(struct lttng_ust_channel_buffer *lttng_chan) { struct lttng_ust_lib_ring_buffer_channel *chan; struct lttng_ust_shm_handle *handle; - cds_list_del(<tng_chan->node); + cds_list_del(<tng_chan->priv->node); lttng_destroy_context(lttng_chan->ctx); chan = lttng_chan->chan; handle = lttng_chan->handle; channel_destroy(chan, handle, 0); + free(lttng_chan->parent); + free(lttng_chan->priv); free(lttng_chan); } @@ -284,7 +286,7 @@ void _lttng_event_unregister(struct lttng_ust_event_common *event) void lttng_session_destroy(struct lttng_ust_session *session) { - struct lttng_channel *chan, *tmpchan; + struct lttng_ust_channel_buffer_private *chan, *tmpchan; struct lttng_ust_event_recorder_private *event_recorder_priv, *tmpevent_recorder_priv; struct lttng_enum *_enum, *tmp_enum; struct lttng_event_enabler *event_enabler, *event_tmpenabler; @@ -305,7 +307,7 @@ void lttng_session_destroy(struct lttng_ust_session *session) &session->priv->enums_head, node) _lttng_enum_destroy(_enum); cds_list_for_each_entry_safe(chan, tmpchan, &session->priv->chan_head, node) - _lttng_channel_unmap(chan); + _lttng_channel_unmap(chan->pub); cds_list_del(&session->priv->node); lttng_destroy_context(session->priv->ctx); free(session->priv); @@ -544,7 +546,7 @@ int lttng_session_statedump(struct lttng_ust_session *session) int lttng_session_enable(struct lttng_ust_session *session) { int ret = 0; - struct lttng_channel *chan; + struct lttng_ust_channel_buffer_private *chan; int notify_socket; if (session->active) { @@ -575,7 +577,7 @@ int lttng_session_enable(struct lttng_ust_session *session) /* don't change it if session stop/restart */ if (chan->header_type) continue; - ctx = chan->ctx; + ctx = chan->pub->ctx; if (ctx) { nr_fields = ctx->nr_fields; fields = ctx->fields; @@ -589,7 +591,7 @@ int lttng_session_enable(struct lttng_ust_session *session) ret = ustcomm_register_channel(notify_socket, session, session->priv->objd, - chan->objd, + chan->parent.objd, nr_fields, fields, &chan_id, @@ -634,36 +636,36 @@ end: return ret; } -int lttng_channel_enable(struct lttng_channel *channel) +int lttng_channel_enable(struct lttng_ust_channel_common *lttng_channel) { int ret = 0; - if (channel->enabled) { + if (lttng_channel->enabled) { ret = -EBUSY; goto end; } /* Set transient enabler state to "enabled" */ - channel->tstate = 1; - lttng_session_sync_event_enablers(channel->session); + lttng_channel->priv->tstate = 1; + lttng_session_sync_event_enablers(lttng_channel->session); /* Set atomically the state to "enabled" */ - CMM_ACCESS_ONCE(channel->enabled) = 1; + CMM_ACCESS_ONCE(lttng_channel->enabled) = 1; end: return ret; } -int lttng_channel_disable(struct lttng_channel *channel) +int lttng_channel_disable(struct lttng_ust_channel_common *lttng_channel) { int ret = 0; - if (!channel->enabled) { + if (!lttng_channel->enabled) { ret = -EBUSY; goto end; } /* Set atomically the state to "disabled" */ - CMM_ACCESS_ONCE(channel->enabled) = 0; + CMM_ACCESS_ONCE(lttng_channel->enabled) = 0; /* Set transient enabler state to "enabled" */ - channel->tstate = 0; - lttng_session_sync_event_enablers(channel->session); + lttng_channel->priv->tstate = 0; + lttng_session_sync_event_enablers(lttng_channel->session); end: return ret; } @@ -690,17 +692,17 @@ struct cds_hlist_head *borrow_hash_table_bucket( */ static int lttng_event_recorder_create(struct lttng_ust_event_desc *desc, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { struct lttng_ust_event_recorder *event_recorder; struct lttng_ust_event_recorder_private *event_recorder_priv; - struct lttng_ust_session *session = chan->session; + struct lttng_ust_session *session = chan->parent->session; struct cds_hlist_head *head; int ret = 0; int notify_socket, loglevel; const char *uri; - head = borrow_hash_table_bucket(chan->session->priv->events_ht.table, + head = borrow_hash_table_bucket(chan->parent->session->priv->events_ht.table, LTTNG_UST_EVENT_HT_SIZE, desc); notify_socket = lttng_get_notify_socket(session->priv->owner); @@ -767,7 +769,7 @@ int lttng_event_recorder_create(struct lttng_ust_event_desc *desc, ret = ustcomm_register_event(notify_socket, session, session->priv->objd, - chan->objd, + chan->priv->parent.objd, desc->name, loglevel, desc->signature, @@ -780,7 +782,7 @@ int lttng_event_recorder_create(struct lttng_ust_event_desc *desc, goto sessiond_register_error; } - cds_list_add(&event_recorder_priv->node, &chan->session->priv->events_head); + cds_list_add(&event_recorder_priv->node, &chan->parent->session->priv->events_head); cds_hlist_add_head(&event_recorder_priv->hlist, head); return 0; @@ -1001,7 +1003,7 @@ struct lttng_enabler_ref *lttng_enabler_ref( static void lttng_create_event_recorder_if_missing(struct lttng_event_enabler *event_enabler) { - struct lttng_ust_session *session = event_enabler->chan->session; + struct lttng_ust_session *session = event_enabler->chan->parent->session; struct lttng_ust_probe_desc *probe_desc; struct lttng_ust_event_desc *desc; struct lttng_ust_event_recorder_private *event_recorder_priv; @@ -1132,7 +1134,7 @@ void _event_enum_destroy(struct lttng_ust_event_common *event) case LTTNG_UST_EVENT_TYPE_RECORDER: { struct lttng_ust_event_recorder *event_recorder = event->child; - struct lttng_ust_session *session = event_recorder->chan->session; + struct lttng_ust_session *session = event_recorder->chan->parent->session; unsigned int i; /* Destroy enums of the current event. */ @@ -1199,7 +1201,7 @@ void lttng_probe_provider_unregister_events( static int lttng_event_enabler_ref_event_recorders(struct lttng_event_enabler *event_enabler) { - struct lttng_ust_session *session = event_enabler->chan->session; + struct lttng_ust_session *session = event_enabler->chan->parent->session; struct lttng_ust_event_recorder_private *event_recorder_priv; if (!lttng_event_enabler_as_enabler(event_enabler)->enabled) @@ -1366,7 +1368,7 @@ void lttng_ust_abi_events_exit(void) struct lttng_event_enabler *lttng_event_enabler_create( enum lttng_enabler_format_type format_type, struct lttng_ust_abi_event *event_param, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { struct lttng_event_enabler *event_enabler; @@ -1381,8 +1383,8 @@ struct lttng_event_enabler *lttng_event_enabler_create( event_enabler->chan = chan; /* ctx left NULL */ event_enabler->base.enabled = 0; - cds_list_add(&event_enabler->node, &event_enabler->chan->session->priv->enablers_head); - lttng_session_lazy_sync_event_enablers(event_enabler->chan->session); + cds_list_add(&event_enabler->node, &event_enabler->chan->parent->session->priv->enablers_head); + lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session); return event_enabler; } @@ -1430,7 +1432,7 @@ struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create( int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler) { lttng_event_enabler_as_enabler(event_enabler)->enabled = 1; - lttng_session_lazy_sync_event_enablers(event_enabler->chan->session); + lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session); return 0; } @@ -1438,7 +1440,7 @@ int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler) int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler) { lttng_event_enabler_as_enabler(event_enabler)->enabled = 0; - lttng_session_lazy_sync_event_enablers(event_enabler->chan->session); + lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session); return 0; } @@ -1459,7 +1461,7 @@ int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event _lttng_enabler_attach_filter_bytecode( lttng_event_enabler_as_enabler(event_enabler), bytecode); - lttng_session_lazy_sync_event_enablers(event_enabler->chan->session); + lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session); return 0; } @@ -1479,7 +1481,7 @@ int lttng_event_enabler_attach_exclusion(struct lttng_event_enabler *event_enabl _lttng_enabler_attach_exclusion( lttng_event_enabler_as_enabler(event_enabler), excluder); - lttng_session_lazy_sync_event_enablers(event_enabler->chan->session); + lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session); return 0; } @@ -1667,7 +1669,7 @@ void lttng_session_sync_event_enablers(struct lttng_ust_session *session) * intesection of session and channel transient enable * states. */ - enabled = enabled && session->priv->tstate && event_recorder_priv->pub->chan->tstate; + enabled = enabled && session->priv->tstate && event_recorder_priv->pub->chan->priv->parent.tstate; CMM_STORE_SHARED(event_recorder_priv->pub->parent->enabled, enabled); /* @@ -1947,14 +1949,14 @@ void lttng_ust_context_set_session_provider(const char *name, size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset), void (*record)(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan), + struct lttng_ust_channel_buffer *chan), void (*get_value)(struct lttng_ust_ctx_field *field, struct lttng_ust_ctx_value *value)) { struct lttng_ust_session_private *session_priv; cds_list_for_each_entry(session_priv, &sessions, node) { - struct lttng_channel *chan; + struct lttng_ust_channel_buffer_private *chan; struct lttng_ust_event_recorder_private *event_recorder_priv; int ret; @@ -1963,7 +1965,7 @@ void lttng_ust_context_set_session_provider(const char *name, if (ret) abort(); cds_list_for_each_entry(chan, &session_priv->chan_head, node) { - ret = lttng_ust_context_set_provider_rcu(&chan->ctx, + ret = lttng_ust_context_set_provider_rcu(&chan->pub->ctx, name, get_size, record, get_value); if (ret) abort(); @@ -1988,7 +1990,7 @@ void lttng_ust_context_set_event_notifier_group_provider(const char *name, size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset), void (*record)(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan), + struct lttng_ust_channel_buffer *chan), void (*get_value)(struct lttng_ust_ctx_field *field, struct lttng_ust_ctx_value *value)) { diff --git a/liblttng-ust/lttng-ring-buffer-client.h b/liblttng-ust/lttng-ring-buffer-client.h index f791cd1e..4fbfc709 100644 --- a/liblttng-ust/lttng-ring-buffer-client.h +++ b/liblttng-ust/lttng-ring-buffer-client.h @@ -119,7 +119,7 @@ void ctx_get_struct_size(struct lttng_ust_ctx *ctx, size_t *ctx_len, static inline void ctx_record(struct lttng_ust_lib_ring_buffer_ctx *bufctx, - struct lttng_channel *chan, + struct lttng_ust_channel_buffer *chan, struct lttng_ust_ctx *ctx, enum app_ctx_mode mode) { @@ -172,12 +172,12 @@ size_t record_header_size(const struct lttng_ust_lib_ring_buffer_config *config, struct lttng_ust_lib_ring_buffer_ctx *ctx, struct lttng_client_ctx *client_ctx) { - struct lttng_channel *lttng_chan = channel_get_private(chan); + struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan); struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv; size_t orig_offset = offset; size_t padding; - switch (lttng_chan->header_type) { + switch (lttng_chan->priv->header_type) { case 1: /* compact */ padding = lib_ring_buffer_align(offset, lttng_alignof(uint32_t)); offset += padding; @@ -242,13 +242,13 @@ void lttng_write_event_header(const struct lttng_ust_lib_ring_buffer_config *con struct lttng_ust_lib_ring_buffer_ctx *ctx, uint32_t event_id) { - struct lttng_channel *lttng_chan = channel_get_private(ctx->chan); + struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan); struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv; if (caa_unlikely(ctx->rflags)) goto slow_path; - switch (lttng_chan->header_type) { + switch (lttng_chan->priv->header_type) { case 1: /* compact */ { uint32_t id_time = 0; @@ -293,10 +293,10 @@ void lttng_write_event_header_slow(const struct lttng_ust_lib_ring_buffer_config struct lttng_ust_lib_ring_buffer_ctx *ctx, uint32_t event_id) { - struct lttng_channel *lttng_chan = channel_get_private(ctx->chan); + struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan); struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv; - switch (lttng_chan->header_type) { + switch (lttng_chan->priv->header_type) { case 1: /* compact */ if (!(ctx->rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTTNG_RFLAG_EXTENDED))) { uint32_t id_time = 0; @@ -397,15 +397,15 @@ static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, uint64_t lib_ring_buffer_offset_address(&buf->backend, subbuf_idx * chan->backend.subbuf_size, handle); - struct lttng_channel *lttng_chan = channel_get_private(chan); + struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan); uint64_t cnt = shmp_index(handle, buf->backend.buf_cnt, subbuf_idx)->seq_cnt; assert(header); if (!header) return; header->magic = CTF_MAGIC_NUMBER; - memcpy(header->uuid, lttng_chan->uuid, sizeof(lttng_chan->uuid)); - header->stream_id = lttng_chan->id; + memcpy(header->uuid, lttng_chan->priv->uuid, sizeof(lttng_chan->priv->uuid)); + header->stream_id = lttng_chan->priv->id; header->stream_instance_id = buf->backend.cpu; header->ctx.timestamp_begin = tsc; header->ctx.timestamp_end = 0; @@ -548,9 +548,9 @@ static int client_stream_id(struct lttng_ust_lib_ring_buffer *buf, { struct lttng_ust_lib_ring_buffer_channel *chan = shmp(handle, buf->backend.chan); - struct lttng_channel *lttng_chan = channel_get_private(chan); + struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan); - *stream_id = lttng_chan->id; + *stream_id = lttng_chan->priv->id; return 0; } @@ -639,7 +639,7 @@ static const struct lttng_ust_lib_ring_buffer_config client_config = { }; static -struct lttng_channel *_channel_create(const char *name, +struct lttng_ust_channel_buffer *_channel_create(const char *name, void *buf_addr, size_t subbuf_size, size_t num_subbuf, unsigned int switch_timer_interval, @@ -651,13 +651,13 @@ struct lttng_channel *_channel_create(const char *name, { struct lttng_ust_abi_channel_config chan_priv_init; struct lttng_ust_shm_handle *handle; - struct lttng_channel *lttng_chan; + struct lttng_ust_channel_buffer *lttng_chan_buf; - lttng_chan = zmalloc(sizeof(struct lttng_channel)); - if (!lttng_chan) + lttng_chan_buf = lttng_ust_alloc_channel_buffer(); + if (!lttng_chan_buf) return NULL; - memcpy(lttng_chan->uuid, uuid, LTTNG_UST_UUID_LEN); - lttng_chan->id = chan_id; + memcpy(lttng_chan_buf->priv->uuid, uuid, LTTNG_UST_UUID_LEN); + lttng_chan_buf->priv->id = chan_id; memset(&chan_priv_init, 0, sizeof(chan_priv_init)); memcpy(chan_priv_init.uuid, uuid, LTTNG_UST_UUID_LEN); @@ -667,32 +667,32 @@ struct lttng_channel *_channel_create(const char *name, __alignof__(struct lttng_ust_abi_channel_config), sizeof(struct lttng_ust_abi_channel_config), &chan_priv_init, - lttng_chan, buf_addr, subbuf_size, num_subbuf, + lttng_chan_buf, buf_addr, subbuf_size, num_subbuf, switch_timer_interval, read_timer_interval, stream_fds, nr_stream_fds, blocking_timeout); if (!handle) goto error; - lttng_chan->handle = handle; - lttng_chan->chan = shmp(handle, handle->chan); - return lttng_chan; + lttng_chan_buf->handle = handle; + lttng_chan_buf->chan = shmp(handle, handle->chan); + return lttng_chan_buf; error: - free(lttng_chan); + lttng_ust_free_channel_common(lttng_chan_buf->parent); return NULL; } static -void lttng_channel_destroy(struct lttng_channel *chan) +void lttng_channel_destroy(struct lttng_ust_channel_buffer *lttng_chan_buf) { - channel_destroy(chan->chan, chan->handle, 1); - free(chan); + channel_destroy(lttng_chan_buf->chan, lttng_chan_buf->handle, 1); + lttng_ust_free_channel_common(lttng_chan_buf->parent); } static int lttng_event_reserve(struct lttng_ust_lib_ring_buffer_ctx *ctx, uint32_t event_id) { - struct lttng_channel *lttng_chan = channel_get_private(ctx->chan); + struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan); struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv; struct lttng_client_ctx client_ctx; int ret, cpu; @@ -708,7 +708,7 @@ int lttng_event_reserve(struct lttng_ust_lib_ring_buffer_ctx *ctx, return -EPERM; ctx->cpu = cpu; - switch (lttng_chan->header_type) { + switch (lttng_chan->priv->header_type) { case 1: /* compact */ if (event_id > 30) ctx->rflags |= LTTNG_RFLAG_EXTENDED; diff --git a/liblttng-ust/lttng-ring-buffer-metadata-client.h b/liblttng-ust/lttng-ring-buffer-metadata-client.h index 956de9fd..8a594397 100644 --- a/liblttng-ust/lttng-ring-buffer-metadata-client.h +++ b/liblttng-ust/lttng-ring-buffer-metadata-client.h @@ -92,13 +92,13 @@ static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, uint64_t lib_ring_buffer_offset_address(&buf->backend, subbuf_idx * chan->backend.subbuf_size, handle); - struct lttng_channel *lttng_chan = channel_get_private(chan); + struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan); assert(header); if (!header) return; header->magic = TSDL_MAGIC_NUMBER; - memcpy(header->uuid, lttng_chan->uuid, sizeof(lttng_chan->uuid)); + memcpy(header->uuid, lttng_chan->priv->uuid, sizeof(lttng_chan->priv->uuid)); header->checksum = 0; /* 0 if unused */ header->content_size = 0xFFFFFFFF; /* in bits, for debugging */ header->packet_size = 0xFFFFFFFF; /* in bits, for debugging */ @@ -190,7 +190,7 @@ static const struct lttng_ust_lib_ring_buffer_config client_config = { }; static -struct lttng_channel *_channel_create(const char *name, +struct lttng_ust_channel_buffer *_channel_create(const char *name, void *buf_addr, size_t subbuf_size, size_t num_subbuf, unsigned int switch_timer_interval, @@ -202,41 +202,41 @@ struct lttng_channel *_channel_create(const char *name, { struct lttng_ust_abi_channel_config chan_priv_init; struct lttng_ust_shm_handle *handle; - struct lttng_channel *lttng_chan; + struct lttng_ust_channel_buffer *lttng_chan_buf; - lttng_chan = zmalloc(sizeof(struct lttng_channel)); - if (!lttng_chan) + lttng_chan_buf = lttng_ust_alloc_channel_buffer(); + if (!lttng_chan_buf) return NULL; - memcpy(lttng_chan->uuid, uuid, LTTNG_UST_UUID_LEN); - lttng_chan->id = chan_id; + memcpy(lttng_chan_buf->priv->uuid, uuid, LTTNG_UST_UUID_LEN); + lttng_chan_buf->priv->id = chan_id; memset(&chan_priv_init, 0, sizeof(chan_priv_init)); memcpy(chan_priv_init.uuid, uuid, LTTNG_UST_UUID_LEN); chan_priv_init.id = chan_id; handle = channel_create(&client_config, name, - __alignof__(struct lttng_channel), - sizeof(struct lttng_channel), + __alignof__(struct lttng_ust_channel_buffer), + sizeof(struct lttng_ust_channel_buffer), &chan_priv_init, - lttng_chan, buf_addr, subbuf_size, num_subbuf, + lttng_chan_buf, buf_addr, subbuf_size, num_subbuf, switch_timer_interval, read_timer_interval, stream_fds, nr_stream_fds, blocking_timeout); if (!handle) goto error; - lttng_chan->handle = handle; - lttng_chan->chan = shmp(handle, handle->chan); - return lttng_chan; + lttng_chan_buf->handle = handle; + lttng_chan_buf->chan = shmp(handle, handle->chan); + return lttng_chan_buf; error: - free(lttng_chan); + lttng_ust_free_channel_common(lttng_chan_buf->parent); return NULL; } static -void lttng_channel_destroy(struct lttng_channel *chan) +void lttng_channel_destroy(struct lttng_ust_channel_buffer *lttng_chan_buf) { - channel_destroy(chan->chan, chan->handle, 1); - free(chan); + channel_destroy(lttng_chan_buf->chan, lttng_chan_buf->handle, 1); + lttng_ust_free_channel_common(lttng_chan_buf->parent); } static diff --git a/liblttng-ust/lttng-tracer-core.h b/liblttng-ust/lttng-tracer-core.h index a292dae5..80b49f7f 100644 --- a/liblttng-ust/lttng-tracer-core.h +++ b/liblttng-ust/lttng-tracer-core.h @@ -25,11 +25,11 @@ #define LTTNG_PROC_NS_PATH_MAX 40 struct lttng_ust_session; -struct lttng_channel; -struct lttng_event; +struct lttng_ust_channel_buffer; struct lttng_ust_ctx_field; struct lttng_ust_lib_ring_buffer_ctx; struct lttng_ust_ctx_value; +struct lttng_ust_event_recorder; struct lttng_ust_event_notifier; __attribute__((visibility("hidden"))) @@ -92,7 +92,7 @@ size_t lttng_ust_dummy_get_size(struct lttng_ust_ctx_field *field, size_t offset __attribute__((visibility("hidden"))) void lttng_ust_dummy_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan); + struct lttng_ust_channel_buffer *chan); __attribute__((visibility("hidden"))) void lttng_ust_dummy_get_value(struct lttng_ust_ctx_field *field, struct lttng_ust_ctx_value *value); diff --git a/liblttng-ust/lttng-ust-abi.c b/liblttng-ust/lttng-ust-abi.c index a1903451..9c4ddf15 100644 --- a/liblttng-ust/lttng-ust-abi.c +++ b/liblttng-ust/lttng-ust-abi.c @@ -287,7 +287,7 @@ int lttng_abi_create_root_handle(void) } static -int lttng_is_channel_ready(struct lttng_channel *lttng_chan) +int lttng_is_channel_ready(struct lttng_ust_channel_buffer *lttng_chan) { struct lttng_ust_lib_ring_buffer_channel *chan; unsigned int nr_streams, exp_streams; @@ -449,7 +449,7 @@ int lttng_abi_map_channel(int session_objd, int chan_objd; struct lttng_ust_shm_handle *channel_handle; struct lttng_ust_abi_channel_config *lttng_chan_config; - struct lttng_channel *lttng_chan; + struct lttng_ust_channel_buffer *lttng_chan_buf; struct lttng_ust_lib_ring_buffer_channel *chan; struct lttng_ust_lib_ring_buffer_config *config; void *chan_data; @@ -476,10 +476,10 @@ int lttng_abi_map_channel(int session_objd, goto active; /* Refuse to add channel to active session */ } - lttng_chan = zmalloc(sizeof(struct lttng_channel)); - if (!lttng_chan) { + lttng_chan_buf = lttng_ust_alloc_channel_buffer(); + if (!lttng_chan_buf) { ret = -ENOMEM; - goto lttng_chan_error; + goto lttng_chan_buf_error; } channel_handle = channel_handle_create(chan_data, len, wakeup_fd); @@ -544,30 +544,33 @@ int lttng_abi_map_channel(int session_objd, } /* Initialize our lttng chan */ - lttng_chan->chan = chan; - lttng_chan->tstate = 1; - lttng_chan->enabled = 1; - lttng_chan->ctx = NULL; - lttng_chan->session = session; - lttng_chan->ops = &transport->ops; - memcpy(<tng_chan->chan->backend.config, + lttng_chan_buf->parent->enabled = 1; + lttng_chan_buf->parent->session = session; + + lttng_chan_buf->priv->parent.tstate = 1; + + lttng_chan_buf->ctx = NULL; + lttng_chan_buf->ops = &transport->ops; + lttng_chan_buf->chan = chan; + lttng_chan_buf->handle = channel_handle; + + memcpy(&chan->backend.config, transport->client_config, - sizeof(lttng_chan->chan->backend.config)); - cds_list_add(<tng_chan->node, &session->priv->chan_head); - lttng_chan->header_type = 0; - lttng_chan->handle = channel_handle; - lttng_chan->type = type; + sizeof(chan->backend.config)); + cds_list_add(<tng_chan_buf->priv->node, &session->priv->chan_head); + lttng_chan_buf->priv->header_type = 0; + lttng_chan_buf->priv->type = type; /* Copy fields from lttng ust chan config. */ - lttng_chan->id = lttng_chan_config->id; - memcpy(lttng_chan->uuid, lttng_chan_config->uuid, LTTNG_UST_UUID_LEN); - channel_set_private(chan, lttng_chan); + lttng_chan_buf->priv->id = lttng_chan_config->id; + memcpy(lttng_chan_buf->priv->uuid, lttng_chan_config->uuid, LTTNG_UST_UUID_LEN); + channel_set_private(chan, lttng_chan_buf); /* * We tolerate no failure path after channel creation. It will stay * invariant for the rest of the session. */ - objd_set_private(chan_objd, lttng_chan); - lttng_chan->objd = chan_objd; + objd_set_private(chan_objd, lttng_chan_buf); + lttng_chan_buf->priv->parent.objd = chan_objd; /* The channel created holds a reference on the session */ objd_ref(session_objd); return chan_objd; @@ -577,12 +580,12 @@ objd_error: notransport: alloc_error: channel_destroy(chan, channel_handle, 0); - free(lttng_chan); + lttng_ust_free_channel_common(lttng_chan_buf->parent); return ret; handle_error: - free(lttng_chan); -lttng_chan_error: + lttng_ust_free_channel_common(lttng_chan_buf->parent); +lttng_chan_buf_error: active: invalid: return ret; @@ -1108,10 +1111,10 @@ static int lttng_abi_map_stream(int channel_objd, struct lttng_ust_abi_stream *info, union lttng_ust_abi_args *uargs, void *owner) { - struct lttng_channel *channel = objd_private(channel_objd); + struct lttng_ust_channel_buffer *lttng_chan_buf = objd_private(channel_objd); int ret; - ret = channel_handle_add_stream(channel->handle, + ret = channel_handle_add_stream(lttng_chan_buf->handle, uargs->stream.shm_fd, uargs->stream.wakeup_fd, info->stream_nr, info->len); if (ret) @@ -1132,7 +1135,7 @@ int lttng_abi_create_event_enabler(int channel_objd, void *owner, enum lttng_enabler_format_type format_type) { - struct lttng_channel *channel = objd_private(channel_objd); + struct lttng_ust_channel_buffer *channel = objd_private(channel_objd); struct lttng_event_enabler *enabler; int event_objd, ret; @@ -1196,13 +1199,13 @@ static long lttng_channel_cmd(int objd, unsigned int cmd, unsigned long arg, union lttng_ust_abi_args *uargs, void *owner) { - struct lttng_channel *channel = objd_private(objd); + struct lttng_ust_channel_buffer *lttng_chan_buf = objd_private(objd); if (cmd != LTTNG_UST_ABI_STREAM) { /* * Check if channel received all streams. */ - if (!lttng_is_channel_ready(channel)) + if (!lttng_is_channel_ready(lttng_chan_buf)) return -EPERM; } @@ -1235,13 +1238,15 @@ long lttng_channel_cmd(int objd, unsigned int cmd, unsigned long arg, case LTTNG_UST_ABI_CONTEXT: return lttng_abi_add_context(objd, (struct lttng_ust_abi_context *) arg, uargs, - &channel->ctx, channel->session); + <tng_chan_buf->ctx, + lttng_chan_buf->parent->session); case LTTNG_UST_ABI_ENABLE: - return lttng_channel_enable(channel); + return lttng_channel_enable(lttng_chan_buf->parent); case LTTNG_UST_ABI_DISABLE: - return lttng_channel_disable(channel); + return lttng_channel_disable(lttng_chan_buf->parent); case LTTNG_UST_ABI_FLUSH_BUFFER: - return channel->ops->priv->flush_buffer(channel->chan, channel->handle); + return lttng_chan_buf->ops->priv->flush_buffer(lttng_chan_buf->chan, + lttng_chan_buf->handle); default: return -EINVAL; } @@ -1250,10 +1255,10 @@ long lttng_channel_cmd(int objd, unsigned int cmd, unsigned long arg, static int lttng_channel_release(int objd) { - struct lttng_channel *channel = objd_private(objd); + struct lttng_ust_channel_buffer *lttng_chan_buf = objd_private(objd); - if (channel) - return lttng_ust_abi_objd_unref(channel->session->priv->objd, 0); + if (lttng_chan_buf) + return lttng_ust_abi_objd_unref(lttng_chan_buf->parent->session->priv->objd, 0); return 0; } @@ -1324,7 +1329,7 @@ int lttng_event_enabler_release(int objd) struct lttng_event_enabler *event_enabler = objd_private(objd); if (event_enabler) - return lttng_ust_abi_objd_unref(event_enabler->chan->objd, 0); + return lttng_ust_abi_objd_unref(event_enabler->chan->priv->parent.objd, 0); return 0; } diff --git a/liblttng-ust/ust-core.c b/liblttng-ust/ust-core.c index 0b1fcf0b..9f21b977 100644 --- a/liblttng-ust/ust-core.c +++ b/liblttng-ust/ust-core.c @@ -116,7 +116,7 @@ size_t lttng_ust_dummy_get_size(struct lttng_ust_ctx_field *field, size_t offset void lttng_ust_dummy_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *chan) { char sel_char = (char) LTTNG_UST_DYNAMIC_TYPE_NONE; @@ -137,3 +137,56 @@ int lttng_context_is_app(const char *name) } return 1; } + +struct lttng_ust_channel_buffer *lttng_ust_alloc_channel_buffer(void) +{ + struct lttng_ust_channel_buffer *lttng_chan_buf; + struct lttng_ust_channel_common *lttng_chan_common; + struct lttng_ust_channel_buffer_private *lttng_chan_buf_priv; + + lttng_chan_buf = zmalloc(sizeof(struct lttng_ust_channel_buffer)); + if (!lttng_chan_buf) + goto lttng_chan_buf_error; + lttng_chan_buf->struct_size = sizeof(struct lttng_ust_channel_buffer); + lttng_chan_common = zmalloc(sizeof(struct lttng_ust_channel_common)); + if (!lttng_chan_common) + goto lttng_chan_common_error; + lttng_chan_common->struct_size = sizeof(struct lttng_ust_channel_common); + lttng_chan_buf_priv = zmalloc(sizeof(struct lttng_ust_channel_buffer_private)); + if (!lttng_chan_buf_priv) + goto lttng_chan_buf_priv_error; + lttng_chan_buf->parent = lttng_chan_common; + lttng_chan_common->type = LTTNG_UST_CHANNEL_TYPE_BUFFER; + lttng_chan_common->child = lttng_chan_buf; + lttng_chan_buf->priv = lttng_chan_buf_priv; + lttng_chan_common->priv = <tng_chan_buf_priv->parent; + lttng_chan_buf_priv->pub = lttng_chan_buf; + lttng_chan_buf_priv->parent.pub = lttng_chan_common; + + return lttng_chan_buf; + +lttng_chan_buf_priv_error: + free(lttng_chan_common); +lttng_chan_common_error: + free(lttng_chan_buf); +lttng_chan_buf_error: + return NULL; +} + +void lttng_ust_free_channel_common(struct lttng_ust_channel_common *chan) +{ + switch (chan->type) { + case LTTNG_UST_CHANNEL_TYPE_BUFFER: + { + struct lttng_ust_channel_buffer *chan_buf; + + chan_buf = (struct lttng_ust_channel_buffer *)chan->child; + free(chan_buf->parent); + free(chan_buf->priv); + free(chan_buf); + break; + } + default: + abort(); + } +} diff --git a/liblttng-ust/ust-events-internal.h b/liblttng-ust/ust-events-internal.h index bed7a85c..d79278d7 100644 --- a/liblttng-ust/ust-events-internal.h +++ b/liblttng-ust/ust-events-internal.h @@ -76,7 +76,7 @@ struct lttng_enabler { struct lttng_event_enabler { struct lttng_enabler base; struct cds_list_head node; /* per-session list of enablers */ - struct lttng_channel *chan; + struct lttng_ust_channel_buffer *chan; /* * Unused, but kept around to make it explicit that the tracer can do * it. @@ -316,10 +316,12 @@ struct lttng_enum { uint64_t id; /* Enumeration ID in sessiond */ }; +struct lttng_ust_shm_handle; + struct lttng_ust_channel_ops_private { struct lttng_ust_channel_ops *pub; /* Public channels ops interface */ - struct lttng_channel *(*channel_create)(const char *name, + struct lttng_ust_channel_buffer *(*channel_create)(const char *name, void *buf_addr, size_t subbuf_size, size_t num_subbuf, unsigned int switch_timer_interval, @@ -328,7 +330,7 @@ struct lttng_ust_channel_ops_private { uint32_t chan_id, const int *stream_fds, int nr_stream_fds, int64_t blocking_timeout); - void (*channel_destroy)(struct lttng_channel *chan); + void (*channel_destroy)(struct lttng_ust_channel_buffer *chan); /* * packet_avail_size returns the available size in the current * packet. Note that the size returned is only a hint, since it @@ -342,6 +344,24 @@ struct lttng_ust_channel_ops_private { struct lttng_ust_shm_handle *handle); }; +struct lttng_ust_channel_common_private { + struct lttng_ust_channel_common *pub; /* Public channel interface */ + + int objd; /* Object associated with channel. */ + int tstate:1; /* Transient enable state */ +}; + +struct lttng_ust_channel_buffer_private { + struct lttng_ust_channel_common_private parent; + + struct lttng_ust_channel_buffer *pub; /* Public channel buffer interface */ + struct cds_list_head node; /* Channel list in session */ + int header_type; /* 0: unset, 1: compact, 2: large */ + unsigned int id; /* Channel ID */ + enum lttng_ust_abi_chan_type type; + unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */ +}; + /* * IMPORTANT: this structure is part of the ABI between the consumer * daemon and the UST library within traced applications. Changing it @@ -550,7 +570,7 @@ __attribute__((visibility("hidden"))) struct lttng_event_enabler *lttng_event_enabler_create( enum lttng_enabler_format_type format_type, struct lttng_ust_abi_event *event_param, - struct lttng_channel *chan); + struct lttng_ust_channel_buffer *chan); /* * Destroy a `struct lttng_event_enabler` object. @@ -787,21 +807,10 @@ __attribute__((visibility("hidden"))) void lttng_handle_pending_statedump(void *owner); __attribute__((visibility("hidden"))) -struct lttng_channel *lttng_channel_create(struct lttng_ust_session *session, - const char *transport_name, - void *buf_addr, - size_t subbuf_size, size_t num_subbuf, - unsigned int switch_timer_interval, - unsigned int read_timer_interval, - int **shm_fd, int **wait_fd, - uint64_t **memory_map_size, - struct lttng_channel *chan_priv_init); +int lttng_channel_enable(struct lttng_ust_channel_common *lttng_channel); __attribute__((visibility("hidden"))) -int lttng_channel_enable(struct lttng_channel *channel); - -__attribute__((visibility("hidden"))) -int lttng_channel_disable(struct lttng_channel *channel); +int lttng_channel_disable(struct lttng_ust_channel_common *lttng_channel); __attribute__((visibility("hidden"))) void lttng_transport_register(struct lttng_transport *transport); @@ -846,4 +855,10 @@ void lttng_ust_abi_events_exit(void); __attribute__((visibility("hidden"))) 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); + #endif /* _LTTNG_UST_EVENTS_INTERNAL_H */ diff --git a/tests/compile/test-app-ctx/hello.c b/tests/compile/test-app-ctx/hello.c index 19901c7c..6b1a6bd3 100644 --- a/tests/compile/test-app-ctx/hello.c +++ b/tests/compile/test-app-ctx/hello.c @@ -104,13 +104,13 @@ size_t test_get_size(struct lttng_ust_ctx_field *field, size_t offset) static void test_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *lttng_chan_buf) { int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES; char sel_char = (char) sel; lib_ring_buffer_align_ctx(ctx, lttng_alignof(char)); - chan->ops->event_write(ctx, &sel_char, sizeof(sel_char)); + lttng_chan_buf->ops->event_write(ctx, &sel_char, sizeof(sel_char)); switch (sel) { case LTTNG_UST_DYNAMIC_TYPE_NONE: break; @@ -119,7 +119,7 @@ void test_record(struct lttng_ust_ctx_field *field, int8_t v = -8; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_S16: @@ -127,7 +127,7 @@ void test_record(struct lttng_ust_ctx_field *field, int16_t v = -16; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_S32: @@ -135,7 +135,7 @@ void test_record(struct lttng_ust_ctx_field *field, int32_t v = -32; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_S64: @@ -143,7 +143,7 @@ void test_record(struct lttng_ust_ctx_field *field, int64_t v = -64; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_U8: @@ -151,7 +151,7 @@ void test_record(struct lttng_ust_ctx_field *field, uint8_t v = 8; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_U16: @@ -159,7 +159,7 @@ void test_record(struct lttng_ust_ctx_field *field, uint16_t v = 16; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_U32: @@ -167,7 +167,7 @@ void test_record(struct lttng_ust_ctx_field *field, uint32_t v = 32; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_U64: @@ -175,7 +175,7 @@ void test_record(struct lttng_ust_ctx_field *field, uint64_t v = 64; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_FLOAT: @@ -183,7 +183,7 @@ void test_record(struct lttng_ust_ctx_field *field, float f = 22322.0; lib_ring_buffer_align_ctx(ctx, lttng_alignof(f)); - chan->ops->event_write(ctx, &f, sizeof(f)); + lttng_chan_buf->ops->event_write(ctx, &f, sizeof(f)); break; } case LTTNG_UST_DYNAMIC_TYPE_DOUBLE: @@ -191,13 +191,13 @@ void test_record(struct lttng_ust_ctx_field *field, double d = 2.0; lib_ring_buffer_align_ctx(ctx, lttng_alignof(d)); - chan->ops->event_write(ctx, &d, sizeof(d)); + lttng_chan_buf->ops->event_write(ctx, &d, sizeof(d)); break; } case LTTNG_UST_DYNAMIC_TYPE_STRING: { const char *str = "teststr"; - chan->ops->event_write(ctx, str, strlen(str) + 1); + lttng_chan_buf->ops->event_write(ctx, str, strlen(str) + 1); break; } default: -- 2.34.1