Fix: liblttng-ctl: ABI-breaking size change of lttng_session struct
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 2 Oct 2019 22:04:43 +0000 (18:04 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 2 Oct 2019 22:04:43 +0000 (18:04 -0400)
commite9af56b3027eebc314384a797c01e6a7e35c8fd2
treeeb3bafeb5614a133e45af1f4be2844f0ccbe0f43
parenta416382b7be5ed002816bd6fae22eb9b2048c252
Fix: liblttng-ctl: ABI-breaking size change of lttng_session struct

abidiff reports that the size of struct lttng_session has changed
since 2.10:

  [C]'function int lttng_list_sessions(lttng_session**)' at lttng-ctl.c:2065:1 has some indirect sub-type changes:
    parameter 1 of type 'lttng_session**' has sub-type changes:
      in pointed to type 'lttng_session*':
        in pointed to type 'struct lttng_session' at session.h:38:1:
          type size changed from 35008 to 35072 (in bits)
          1 data member deletion:
            'char lttng_session::padding[12]', at offset 34912 (in bits) at session.h:50:1

          1 data member insertion:
            'union {char padding[12]; void* ptr;} lttng_session::extended', at offset 34944 (in bits) at session.h:57:1

The offset after the 'live_timer_interval' field is aligned on 4
bytes, but not on 8 bytes. This causes some compilers (such as gcc and
clang) to align the following 'extended' union on 8 bytes, making the
overall structure larger.

To preserve the size of 'struct lttng_session', four bytes of padding
are added after 'live_timer_interval', resulting in an aligned offset
for both bitnesses.

The 'extended' union's padding is reduced from 12 to 8 bytes,
essentially ensuring that 'ptr' always occupies 8 bytes, even on
32-bit builds.

Tested on clang and gcc for x64, x86, PPC32, PPC64, ARM, ARM64,
AVR, MIPS, MIPS64, and MSVC (32-bit and 64-bit).

Reviewed-by: Michael Jeanson <michael.jeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/lttng/session.h
This page took 0.024581 seconds and 4 git commands to generate.