[lttng-dev] [RFC PATCH lttng-tools v2 11/20] Add serialized versions of lttng_event_context structs

Yannick Lamarre ylamarre at efficios.com
Wed May 1 15:34:35 EDT 2019

Serialized versions of lttng_event_context and lttng_event_perf_counter_ctx are
packed structures to be used in communication protocols for consistent
sizes across platforms. The serialized versions are stripped of pointers
and padding.

Pointers are removed since their size can vary across processes on
platforms supporting multiple pointer sizes (32bits vs 64bits) and this
creates mismatches in structure sizes.
Padding is also removed since it defeats the purpose of a packed struct
and is not used to extend the protocols.

Signed-off-by: Yannick Lamarre <ylamarre at efficios.com>
Reworded commit message to better justify removal of pointer and padding

 include/lttng/event-internal.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/lttng/event-internal.h b/include/lttng/event-internal.h
index f8130e3b..25a88448 100644
--- a/include/lttng/event-internal.h
+++ b/include/lttng/event-internal.h
@@ -27,6 +27,17 @@
 struct lttng_userspace_probe_location;
+struct lttng_event_perf_counter_ctx_serialized {
+	uint32_t type;
+	uint64_t config;
+struct lttng_event_context_serialized {
+	uint32_t ctx; /* enum lttng_event_context_type */
+	struct lttng_event_perf_counter_ctx_serialized perf_counter;
 struct lttng_event_extended {
 	 * exclusions and filter_expression are only set when the lttng_event

More information about the lttng-dev mailing list