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

Yannick Lamarre ylamarre at efficios.com
Wed May 1 15:34:41 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 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/snapshot-internal.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/lttng/snapshot-internal.h b/include/lttng/snapshot-internal.h
index b7391c22..9bde25fb 100644
--- a/include/lttng/snapshot-internal.h
+++ b/include/lttng/snapshot-internal.h
@@ -21,6 +21,7 @@
 #include <limits.h>
 #include <stdint.h>
 #include <lttng/constant.h>
+#include <common/macros.h>
  * Object used for the snapshot API. This is opaque to the public library.
@@ -45,6 +46,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];
  * Snapshot output list object opaque to the user.

More information about the lttng-dev mailing list