X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fsessiond-comm%2Frelayd.h;fp=src%2Fcommon%2Fsessiond-comm%2Frelayd.h;h=36a91070cbfd0cf6a587d238f6712912b9b78de0;hp=fe7d2936d869a0f03dcc82078b005d3592cdbd90;hb=ce9dbd47eea9fe023691518ef46b58c03b89c236;hpb=dc97de748114492f69e015dae08fcfcfc8e072ef diff --git a/src/common/sessiond-comm/relayd.h b/src/common/sessiond-comm/relayd.h index fe7d2936d..36a91070c 100644 --- a/src/common/sessiond-comm/relayd.h +++ b/src/common/sessiond-comm/relayd.h @@ -239,17 +239,70 @@ struct lttcomm_relayd_stream_rotation_position { uint64_t rotate_at_seq_num; } LTTNG_PACKED; +/* + * For certain releases, the LTTNG_PACKED annotation was missing on the + * `new_chunk_id` field which causes padding to be added between the + * "optional" structure's `is_set` and `value` fields. + * + * Three alignment cases are handled: + * - `value` is aligned to the next byte boundary after `is_set` + * no padding is produced, see + * `struct lttcomm_relayd_rotate_streams_packed`, + * - `value` is aligned to the next 4-byte boundary after `is_set` + * (e.g. x86), 3 bytes of padding are produced, see + * `struct lttcomm_relayd_rotate_streams_3_bytes_padding`, + * - `value` is aligned to the next 8-byte boundary after `is_set` + * (e.g. x86-64), 7 bytes of padding are produced, see + * `struct lttcomm_relayd_rotate_streams_7_bytes_padding`. + * + * Note that since this structure's advertised size is used to determine + * the size of the padding it includes, it can't be extended with new + * optional fields. A new command would be needed. + */ struct lttcomm_relayd_rotate_streams { uint32_t stream_count; /* * Streams can be rotated outside of a chunk but not be parented to * a new chunk. + * + * Improperly packed, but left as-is for backwards compatibility + * with unpatched relay daemons. */ LTTNG_OPTIONAL_COMM(uint64_t) new_chunk_id; /* `stream_count` positions follow. */ struct lttcomm_relayd_stream_rotation_position rotation_positions[]; } LTTNG_PACKED; +struct lttcomm_relayd_rotate_streams_packed { + uint32_t stream_count; + LTTNG_OPTIONAL_COMM(uint64_t) LTTNG_PACKED new_chunk_id; + struct lttcomm_relayd_stream_rotation_position rotation_positions[]; +} LTTNG_PACKED; + +struct lttcomm_relayd_rotate_streams_3_bytes_padding { + uint32_t stream_count; + struct { + union { + uint8_t is_set; + uint32_t padding; + }; + uint64_t value; + } LTTNG_PACKED new_chunk_id; + struct lttcomm_relayd_stream_rotation_position rotation_positions[]; +} LTTNG_PACKED; + +struct lttcomm_relayd_rotate_streams_7_bytes_padding { + uint32_t stream_count; + struct { + union { + uint8_t is_set; + uint64_t padding; + }; + uint64_t value; + } LTTNG_PACKED new_chunk_id; + struct lttcomm_relayd_stream_rotation_position rotation_positions[]; +} LTTNG_PACKED; + struct lttcomm_relayd_create_trace_chunk { uint64_t chunk_id; /* Seconds since EPOCH. */