X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=libringbuffer%2Fring_buffer_frontend.c;h=436e4b8c89981e5ebe7b2dffb679b43fbd521c54;hb=c1fca4572d4458b2e6e96752f9efc595c5f72405;hp=310e0b93e51a435b74e6d0b9d0c6b4ebc6226abf;hpb=02a15cfb0d1fbff3960e184e901c297588b215f0;p=lttng-ust.git diff --git a/libringbuffer/ring_buffer_frontend.c b/libringbuffer/ring_buffer_frontend.c index 310e0b93..436e4b8c 100644 --- a/libringbuffer/ring_buffer_frontend.c +++ b/libringbuffer/ring_buffer_frontend.c @@ -452,6 +452,7 @@ struct lttng_ust_shm_handle *channel_create(const struct lttng_ust_lib_ring_buff /* Calculate the shm allocation layout */ shmsize = sizeof(struct channel); + shmsize += offset_align(shmsize, __alignof__(struct lttng_ust_lib_ring_buffer_shmp)); if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) shmsize += sizeof(struct lttng_ust_lib_ring_buffer_shmp) * num_possible_cpus(); else @@ -461,7 +462,7 @@ struct lttng_ust_shm_handle *channel_create(const struct lttng_ust_lib_ring_buff if (!shmobj) goto error_append; /* struct channel is at object 0, offset 0 (hardcoded) */ - set_shmp(handle->chan, zalloc_shm(shmobj, sizeof(struct channel))); + set_shmp(handle->chan, zalloc_shm(shmobj, shmsize)); assert(handle->chan._ref.index == 0); assert(handle->chan._ref.offset == 0); chan = shmp(handle, handle->chan);