Allow consumer to flush buffers, fix alignment bug
[lttng-ust.git] / libringbuffer / ring_buffer_frontend.c
index 310e0b93e51a435b74e6d0b9d0c6b4ebc6226abf..436e4b8c89981e5ebe7b2dffb679b43fbd521c54 100644 (file)
@@ -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);
This page took 0.023455 seconds and 4 git commands to generate.