From: Michael Jeanson Date: Wed, 17 Mar 2021 20:31:53 +0000 (-0400) Subject: Remove the LTTNG_PACKED macro X-Git-Tag: v2.13.0-rc1~248 X-Git-Url: http://git.lttng.org/?p=lttng-ust.git;a=commitdiff_plain;h=9f5ade14faf36df6429d9c6e1d0360854a5669d0 Remove the LTTNG_PACKED macro We already use __attribute__((packed)) directly in some public headers. Remove the LTTNG_PACKED macro and replace it with the literal attribute. The LTTNG_PACKED macro was meant to support Cygwin, but the Cygwin LTTng-UST support was never completed. Change-Id: I8bf5d3db94b979e16bf9b9b5c582b85b6b73f10b Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h index fe253566..843fe4ed 100644 --- a/include/lttng/ust-abi.h +++ b/include/lttng/ust-abi.h @@ -12,10 +12,6 @@ #include #include -#ifndef LTTNG_PACKED -#error "LTTNG_PACKED should be defined" -#endif - #ifndef __ust_stringify #define __ust_stringify1(x) #x #define __ust_stringify(x) __ust_stringify1(x) @@ -57,7 +53,7 @@ struct lttng_ust_abi_tracer_version { uint32_t major; uint32_t minor; uint32_t patchlevel; -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_CHANNEL_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 32) /* @@ -72,7 +68,7 @@ struct lttng_ust_abi_channel { int32_t type; /* enum lttng_ust_abi_chan_type */ char padding[LTTNG_UST_ABI_CHANNEL_PADDING]; char data[]; /* variable sized data */ -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_STREAM_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) struct lttng_ust_abi_stream { @@ -83,7 +79,7 @@ struct lttng_ust_abi_stream { * shm_fd and wakeup_fd are send over unix socket as file * descriptors after this structure. */ -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_COUNTER_DIMENSION_MAX 4 @@ -103,7 +99,7 @@ struct lttng_ust_abi_counter_dimension { uint64_t overflow_index; uint8_t has_underflow; uint8_t has_overflow; -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_COUNTER_CONF_PADDING1 67 struct lttng_ust_abi_counter_conf { @@ -114,13 +110,13 @@ struct lttng_ust_abi_counter_conf { struct lttng_ust_abi_counter_dimension dimensions[LTTNG_UST_ABI_COUNTER_DIMENSION_MAX]; uint8_t coalesce_hits; char padding[LTTNG_UST_ABI_COUNTER_CONF_PADDING1]; -} LTTNG_PACKED; +} __attribute__((packed)); struct lttng_ust_abi_counter_value { uint32_t number_dimensions; uint64_t dimension_indexes[LTTNG_UST_ABI_COUNTER_DIMENSION_MAX]; int64_t value; -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_EVENT_PADDING1 8 #define LTTNG_UST_ABI_EVENT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) @@ -137,21 +133,21 @@ struct lttng_ust_abi_event { union { char padding[LTTNG_UST_ABI_EVENT_PADDING2]; } u; -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_EVENT_NOTIFIER_PADDING 32 struct lttng_ust_abi_event_notifier { struct lttng_ust_abi_event event; uint64_t error_counter_index; char padding[LTTNG_UST_ABI_EVENT_NOTIFIER_PADDING]; -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING 32 struct lttng_ust_abi_event_notifier_notification { uint64_t token; uint16_t capture_buf_size; char padding[LTTNG_UST_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING]; -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_COUNTER_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) #define LTTNG_UST_ABI_COUNTER_DATA_MAX_LEN 4096U @@ -159,20 +155,20 @@ struct lttng_ust_abi_counter { uint64_t len; char padding[LTTNG_UST_ABI_COUNTER_PADDING1]; char data[]; /* variable sized data */ -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) struct lttng_ust_abi_counter_global { uint64_t len; /* shm len */ char padding[LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1]; -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_COUNTER_CPU_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) struct lttng_ust_abi_counter_cpu { uint64_t len; /* shm len */ uint32_t cpu_nr; char padding[LTTNG_UST_ABI_COUNTER_CPU_PADDING1]; -} LTTNG_PACKED; +} __attribute__((packed)); enum lttng_ust_abi_field_type { LTTNG_UST_ABI_FIELD_OTHER = 0, @@ -190,7 +186,7 @@ struct lttng_ust_abi_field_iter { int loglevel; /* event loglevel */ int nowrite; char padding[LTTNG_UST_ABI_FIELD_ITER_PADDING]; -} LTTNG_PACKED; +} __attribute__((packed)); enum lttng_ust_abi_context_type { LTTNG_UST_ABI_CONTEXT_VTID = 0, @@ -221,7 +217,7 @@ struct lttng_ust_abi_perf_counter_ctx { uint32_t type; uint64_t config; char name[LTTNG_UST_ABI_SYM_NAME_LEN]; -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_CONTEXT_PADDING1 16 #define LTTNG_UST_ABI_CONTEXT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) @@ -238,7 +234,7 @@ struct lttng_ust_abi_context { } app_ctx; char padding[LTTNG_UST_ABI_CONTEXT_PADDING2]; } u; -} LTTNG_PACKED; +} __attribute__((packed)); /* * Tracer channel attributes. @@ -257,14 +253,14 @@ struct lttng_ust_abi_channel_attr { } s; char padding[LTTNG_UST_ABI_CHANNEL_ATTR_PADDING]; } u; -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_TRACEPOINT_ITER_PADDING 16 struct lttng_ust_abi_tracepoint_iter { char name[LTTNG_UST_ABI_SYM_NAME_LEN]; /* provider:name */ int loglevel; char padding[LTTNG_UST_ABI_TRACEPOINT_ITER_PADDING]; -} LTTNG_PACKED; +} __attribute__((packed)); enum lttng_ust_abi_object_type { LTTNG_UST_ABI_OBJECT_TYPE_UNKNOWN = -1, @@ -310,7 +306,7 @@ struct lttng_ust_abi_object_data { } counter_cpu; char padding2[LTTNG_UST_ABI_OBJECT_DATA_PADDING2]; } u; -} LTTNG_PACKED; +} __attribute__((packed)); enum lttng_ust_calibrate_type { LTTNG_UST_ABI_CALIBRATE_TRACEPOINT, @@ -325,7 +321,7 @@ struct lttng_ust_abi_calibrate { union { char padding[LTTNG_UST_ABI_CALIBRATE_PADDING2]; } u; -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_FILTER_BYTECODE_MAX_LEN 65536 #define LTTNG_UST_ABI_FILTER_PADDING 32 @@ -335,7 +331,7 @@ struct lttng_ust_abi_filter_bytecode { uint64_t seqnum; char padding[LTTNG_UST_ABI_FILTER_PADDING]; char data[0]; -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_CAPTURE_BYTECODE_MAX_LEN 65536 #define LTTNG_UST_ABI_CAPTURE_PADDING 32 @@ -345,14 +341,14 @@ struct lttng_ust_abi_capture_bytecode { uint64_t seqnum; char padding[LTTNG_UST_ABI_CAPTURE_PADDING]; char data[0]; -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_EXCLUSION_PADDING 32 struct lttng_ust_abi_event_exclusion { uint32_t count; char padding[LTTNG_UST_ABI_EXCLUSION_PADDING]; char names[LTTNG_UST_ABI_SYM_NAME_LEN][0]; -} LTTNG_PACKED; +} __attribute__((packed)); #define LTTNG_UST_ABI_CMD(minor) (minor) #define LTTNG_UST_ABI_CMDR(minor, type) (minor) diff --git a/include/lttng/ust-compiler.h b/include/lttng/ust-compiler.h index dcc72594..f0ec8d0c 100644 --- a/include/lttng/ust-compiler.h +++ b/include/lttng/ust-compiler.h @@ -11,7 +11,6 @@ #include #define lttng_ust_notrace __attribute__((no_instrument_function)) -#define LTTNG_PACKED __attribute__((__packed__)) /* * Clang supports the no_sanitize variable attribute on global variables. diff --git a/include/lttng/ust-ctl.h b/include/lttng/ust-ctl.h index 8b040e2c..39952fa3 100644 --- a/include/lttng/ust-ctl.h +++ b/include/lttng/ust-ctl.h @@ -16,10 +16,6 @@ #include -#ifndef LTTNG_PACKED -#error "LTTNG_PACKED should be defined" -#endif - #ifndef LTTNG_UST_UUID_LEN #define LTTNG_UST_UUID_LEN 16 #endif @@ -51,7 +47,7 @@ struct ustctl_consumer_channel_attr { uint32_t chan_id; /* channel ID */ unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */ int64_t blocking_timeout; /* Blocking timeout (usec) */ -} LTTNG_PACKED; +} __attribute__((packed)); /* * API used by sessiond. @@ -358,7 +354,7 @@ struct ustctl_integer_type { int32_t encoding; /* enum ustctl_string_encodings */ uint16_t alignment; /* in bits */ char padding[USTCTL_UST_INTEGER_TYPE_PADDING]; -} LTTNG_PACKED; +} __attribute__((packed)); #define USTCTL_UST_FLOAT_TYPE_PADDING 24 struct ustctl_float_type { @@ -367,14 +363,14 @@ struct ustctl_float_type { uint32_t reverse_byte_order; uint16_t alignment; /* in bits */ char padding[USTCTL_UST_FLOAT_TYPE_PADDING]; -} LTTNG_PACKED; +} __attribute__((packed)); #define USTCTL_UST_ENUM_VALUE_PADDING 15 struct ustctl_enum_value { uint64_t value; uint8_t signedness; char padding[USTCTL_UST_ENUM_VALUE_PADDING]; -} LTTNG_PACKED; +} __attribute__((packed)); enum ustctl_ust_enum_entry_options { USTCTL_UST_ENUM_ENTRY_OPTION_IS_AUTO = 1U << 0, @@ -387,10 +383,10 @@ struct ustctl_enum_entry { union { struct { uint32_t options; - } LTTNG_PACKED extra; + } __attribute__((packed)) extra; char padding[USTCTL_UST_ENUM_ENTRY_PADDING]; } u; -} LTTNG_PACKED; +} __attribute__((packed)); /* legacy */ #define USTCTL_UST_BASIC_TYPE_PADDING 296 @@ -406,7 +402,7 @@ union _ustctl_basic_type { } string; struct ustctl_float_type _float; char padding[USTCTL_UST_BASIC_TYPE_PADDING]; -} LTTNG_PACKED; +} __attribute__((packed)); /* legacy */ struct ustctl_basic_type { @@ -414,7 +410,7 @@ struct ustctl_basic_type { union { union _ustctl_basic_type basic; } u; -} LTTNG_PACKED; +} __attribute__((packed)); /* * Padding is derived from largest member: u.legacy.sequence which @@ -479,14 +475,14 @@ struct ustctl_type { } legacy; char padding[USTCTL_UST_TYPE_PADDING]; } u; -} LTTNG_PACKED; +} __attribute__((packed)); #define USTCTL_UST_FIELD_PADDING 28 struct ustctl_field { char name[LTTNG_UST_ABI_SYM_NAME_LEN]; struct ustctl_type type; char padding[USTCTL_UST_FIELD_PADDING]; -} LTTNG_PACKED; +} __attribute__((packed)); /* * Returns 0 on success, negative error value on error. diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index 107c746e..59446c4b 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -21,10 +21,6 @@ #include #include -#ifndef LTTNG_PACKED -#error "LTTNG_PACKED should be defined" -#endif - #ifdef __cplusplus extern "C" { #endif diff --git a/include/ust-comm.h b/include/ust-comm.h index 39496921..da3e2a18 100644 --- a/include/ust-comm.h +++ b/include/ust-comm.h @@ -22,10 +22,6 @@ #include #include -#ifndef LTTNG_PACKED -#error "LTTNG_PACKED should be defined" -#endif - /* * Default timeout the application waits for the sessiond to send its * "register done" command. Can be overridden with the environment @@ -64,7 +60,7 @@ struct ustctl_reg_msg { uint32_t socket_type; /* enum ustctl_socket_type */ char name[LTTNG_UST_ABI_PROCNAME_LEN]; /* process name */ char padding[LTTNG_UST_COMM_REG_MSG_PADDING]; -} LTTNG_PACKED; +} __attribute__((packed)); /* * Data structure for the commands sent from sessiond to UST. @@ -86,15 +82,15 @@ struct ustcomm_ust_msg { uint32_t data_size; /* following filter data */ uint32_t reloc_offset; uint64_t seqnum; - } LTTNG_PACKED filter; + } __attribute__((packed)) filter; struct { uint32_t count; /* how many names follow */ - } LTTNG_PACKED exclusion; + } __attribute__((packed)) exclusion; struct { uint32_t data_size; /* following capture data */ uint32_t reloc_offset; uint64_t seqnum; - } LTTNG_PACKED capture; + } __attribute__((packed)) capture; struct lttng_ust_abi_counter counter; struct lttng_ust_abi_counter_global counter_global; struct lttng_ust_abi_counter_cpu counter_cpu; @@ -109,7 +105,7 @@ struct ustcomm_ust_msg { } event_notifier; char padding[USTCOMM_MSG_PADDING2]; } u; -} LTTNG_PACKED; +} __attribute__((packed)); /* * Data structure for the response from UST to the session daemon. @@ -126,19 +122,19 @@ struct ustcomm_ust_reply { union { struct { uint64_t memory_map_size; - } LTTNG_PACKED channel; + } __attribute__((packed)) channel; struct { uint64_t memory_map_size; - } LTTNG_PACKED stream; + } __attribute__((packed)) stream; struct lttng_ust_abi_tracer_version version; struct lttng_ust_abi_tracepoint_iter tracepoint; char padding[USTCOMM_REPLY_PADDING2]; } u; -} LTTNG_PACKED; +} __attribute__((packed)); struct ustcomm_notify_hdr { uint32_t notify_cmd; -} LTTNG_PACKED; +} __attribute__((packed)); #define USTCOMM_NOTIFY_EVENT_MSG_PADDING 32 struct ustcomm_notify_event_msg { @@ -151,14 +147,14 @@ struct ustcomm_notify_event_msg { uint32_t model_emf_uri_len; char padding[USTCOMM_NOTIFY_EVENT_MSG_PADDING]; /* followed by signature, fields, and model_emf_uri */ -} LTTNG_PACKED; +} __attribute__((packed)); #define USTCOMM_NOTIFY_EVENT_REPLY_PADDING 32 struct ustcomm_notify_event_reply { int32_t ret_code; /* 0: ok, negative: error code */ uint32_t event_id; char padding[USTCOMM_NOTIFY_EVENT_REPLY_PADDING]; -} LTTNG_PACKED; +} __attribute__((packed)); #define USTCOMM_NOTIFY_ENUM_MSG_PADDING 32 struct ustcomm_notify_enum_msg { @@ -167,14 +163,14 @@ struct ustcomm_notify_enum_msg { uint32_t entries_len; char padding[USTCOMM_NOTIFY_ENUM_MSG_PADDING]; /* followed by enum entries */ -} LTTNG_PACKED; +} __attribute__((packed)); #define USTCOMM_NOTIFY_EVENT_REPLY_PADDING 32 struct ustcomm_notify_enum_reply { int32_t ret_code; /* 0: ok, negative: error code */ uint64_t enum_id; char padding[USTCOMM_NOTIFY_EVENT_REPLY_PADDING]; -} LTTNG_PACKED; +} __attribute__((packed)); #define USTCOMM_NOTIFY_CHANNEL_MSG_PADDING 32 struct ustcomm_notify_channel_msg { @@ -183,7 +179,7 @@ struct ustcomm_notify_channel_msg { uint32_t ctx_fields_len; char padding[USTCOMM_NOTIFY_CHANNEL_MSG_PADDING]; /* followed by context fields */ -} LTTNG_PACKED; +} __attribute__((packed)); #define USTCOMM_NOTIFY_CHANNEL_REPLY_PADDING 32 struct ustcomm_notify_channel_reply { @@ -191,7 +187,7 @@ struct ustcomm_notify_channel_reply { uint32_t chan_id; uint32_t header_type; /* enum ustctl_channel_header */ char padding[USTCOMM_NOTIFY_CHANNEL_REPLY_PADDING]; -} LTTNG_PACKED; +} __attribute__((packed)); /* * LTTNG_UST_TRACEPOINT_FIELD_LIST reply is followed by a diff --git a/liblttng-ust/bytecode.h b/liblttng-ust/bytecode.h index 4b4b33b6..25ade988 100644 --- a/liblttng-ust/bytecode.h +++ b/liblttng-ust/bytecode.h @@ -10,10 +10,6 @@ #include #include -#ifndef LTTNG_PACKED -#error "LTTNG_PACKED should be defined" -#endif - /* * offsets are absolute from start of bytecode. */ @@ -26,15 +22,15 @@ struct field_ref { struct get_symbol { /* Symbol offset. */ uint16_t offset; -} LTTNG_PACKED; +} __attribute__((packed)); struct get_index_u16 { uint16_t index; -} LTTNG_PACKED; +} __attribute__((packed)); struct get_index_u64 { uint64_t index; -} LTTNG_PACKED; +} __attribute__((packed)); struct literal_numeric { int64_t v;