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 <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
#include <stdint.h>
#include <lttng/ust-compiler.h>
-#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)
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)
/*
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 {
* 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
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 {
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)
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
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,
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,
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)
} app_ctx;
char padding[LTTNG_UST_ABI_CONTEXT_PADDING2];
} u;
-} LTTNG_PACKED;
+} __attribute__((packed));
/*
* Tracer channel attributes.
} 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,
} 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,
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
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
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)
#include <assert.h>
#define lttng_ust_notrace __attribute__((no_instrument_function))
-#define LTTNG_PACKED __attribute__((__packed__))
/*
* Clang supports the no_sanitize variable attribute on global variables.
#include <lttng/ust-abi.h>
-#ifndef LTTNG_PACKED
-#error "LTTNG_PACKED should be defined"
-#endif
-
#ifndef LTTNG_UST_UUID_LEN
#define LTTNG_UST_UUID_LEN 16
#endif
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.
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 {
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,
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
} string;
struct ustctl_float_type _float;
char padding[USTCTL_UST_BASIC_TYPE_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
/* legacy */
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
} 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.
#include <urcu/ref.h>
#include <pthread.h>
-#ifndef LTTNG_PACKED
-#error "LTTNG_PACKED should be defined"
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
#include <lttng/ust-compiler.h>
#include <lttng/ust-ctl.h>
-#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
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.
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;
} event_notifier;
char padding[USTCOMM_MSG_PADDING2];
} u;
-} LTTNG_PACKED;
+} __attribute__((packed));
/*
* Data structure for the response from UST to the session daemon.
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 {
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 {
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 {
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 {
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
#include <stdint.h>
#include <lttng/ust-abi.h>
-#ifndef LTTNG_PACKED
-#error "LTTNG_PACKED should be defined"
-#endif
-
/*
* offsets are absolute from start of bytecode.
*/
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;