Hi all
Fabio noticed that we have some odd attributes on the qb_ipc_header structs.
They currently have (aligned(8)) and should really have (packed) for efficient packing on-wire (http://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Type-Attributes.html).
He noticed this while doing some valgind testing.
This is not so easy to fix as it will break ABI.
So like this:
diff --git a/include/qb/qbipc_common.h b/include/qb/qbipc_common.h index 0a4118c..7af2c7e 100644 --- a/include/qb/qbipc_common.h +++ b/include/qb/qbipc_common.h @@ -32,15 +32,15 @@ extern "C" { /* *INDENT-ON* */
struct qb_ipc_request_header { - int32_t id __attribute__ ((aligned(8))); - int32_t size __attribute__ ((aligned(8))); -} __attribute__ ((aligned(8))); + int32_t id; + int32_t size; +} __attribute__ (packed);
struct qb_ipc_response_header { - int32_t id __attribute__ ((aligned(8))); - int32_t size __attribute__ ((aligned(8))); - int32_t error __attribute__ ((aligned(8))); -} __attribute__ ((aligned(8))); + int32_t id; + int32_t size; + int32_t error; +} __attribute__ (packed);
enum qb_ipc_type { QB_IPC_SOCKET,
Because the alignment changes per arch, this is not so easy to work around.
Is this a problem? Can we just leave it as-is? What other options are there?
Regards -Angus