[lttng-dev] [RFC PATCH lttng-tools 16/18] Add serialized versions of lttng_event structs

Yannick Lamarre ylamarre at efficios.com
Thu Apr 18 12:18:48 EDT 2019


Serialized version of lttng_snapshot_output is a packed structure to be
used in communication protocols for consistent size across platforms.
The serialized version is stripped of pointers and padding.

Pointers are removed since their size can vary on platforms supporting
variable sized registers (x86-64).
Padding is also removed since it defeats the purpose of a packed struct.

Signed-off-by: Yannick Lamarre <ylamarre at efficios.com>
---
 include/lttng/snapshot-internal.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/lttng/snapshot-internal.h b/include/lttng/snapshot-internal.h
index b7391c22..bf9dfbe4 100644
--- a/include/lttng/snapshot-internal.h
+++ b/include/lttng/snapshot-internal.h
@@ -45,6 +45,14 @@ struct lttng_snapshot_output {
 	char data_url[PATH_MAX];
 };
 
+struct lttng_snapshot_output_serialized {
+	uint32_t id;
+	uint64_t max_size;
+	char name[LTTNG_NAME_MAX];
+	char ctrl_url[PATH_MAX];
+	char data_url[PATH_MAX];
+} LTTNG_PACKED;
+
 /*
  * Snapshot output list object opaque to the user.
  */
-- 
2.11.0



More information about the lttng-dev mailing list