Commit fdacddda authored by Martin Åberg's avatar Martin Åberg Committed by Carles Cufi
Browse files

posix: timer: Fix timer_obj alignment



This makes sure the heap posix_timer_slab provides objects aligned
compatible with the type timer_obj. It was previously set to align at 4
bytes. One example where this failed was on the SPARC which requires
access to int64_t to be 8-byte aligned.

In particular, struct timer_obj contains fields of type k_timer_t and
struct _timeout.

With this commit we now get the information on required alignment for
struct timer_obj from the compiler by using __alignof__().

Signed-off-by: default avatarMartin Åberg <martin.aberg@gaisler.com>
parent fdea8518
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ struct timer_obj {
};

K_MEM_SLAB_DEFINE(posix_timer_slab, sizeof(struct timer_obj),
		  CONFIG_MAX_TIMER_COUNT, 4);
		  CONFIG_MAX_TIMER_COUNT, __alignof__(struct timer_obj));

static void zephyr_timer_wrapper(struct k_timer *ztimer)
{