The LTTNG_PACKED macro uses gcc attributes to indicate that a structure
should be packed. Hence, this macro obeys the same rules as the gcc
attribute.
Various mis-uses of the LTTNG_PACKED macros may result in structure not
being packed:
- The LTTNG_PACKED macro should always be placed _before_ an identifier
when a structure is declared in-place.
- Adding LTTNG_PACKED at the definition site has no effect if the
structure was declared elsewhere.
Those mis-uses cause issues when mixing the bitness (32/64) of the
session daemon and liblttng-ctl.
Outstanding issues include the following structures that are not
tagged as LTTNG_PACKED:
- struct lttng_event
- struct lttng_channel
- struct lttng_event_context
Unfortunately, those structures are exposed by the public API and
can't be tagged as being "packed". Doing so would break the ABI
of liblttng-ctl.
These structures should be packed/unpacked explicitly.
JORAJ CHERRY PICK: Change-Id: I095dc0dffc6bf9e15dc7a7ec797958a5780ef150
Change-Id: I33f026a613813af312de65adee23ac829a071cf8
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
struct {
uint64_t value;
uint8_t is_set;
- } creation_time LTTNG_PACKED;
+ } LTTNG_PACKED creation_time;
} LTTNG_PACKED;
#endif /* LTTNG_SESSION_INTERNAL_H */
#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.
char ctrl_url[PATH_MAX];
/* Destination of the output. See lttng(1) for URL format. */
char data_url[PATH_MAX];
-};
+} LTTNG_PACKED;
/*
* Snapshot output list object opaque to the user.
uint32_t size;
} LTTNG_PACKED uri;
struct {
- struct lttng_snapshot_output output LTTNG_PACKED;
+ struct lttng_snapshot_output output;
} LTTNG_PACKED snapshot_output;
struct {
uint32_t wait;
- struct lttng_snapshot_output output LTTNG_PACKED;
+ struct lttng_snapshot_output output;
} LTTNG_PACKED snapshot_record;
struct {
uint32_t nb_uri;
unsigned int timer_interval; /* usec */
} LTTNG_PACKED session_live;
struct {
- struct lttng_save_session_attr attr; /* struct already packed */
+ struct lttng_save_session_attr attr;
} LTTNG_PACKED save_session;
struct {
char shm_path[PATH_MAX];