libust ABI: export streams
[lttng-ust.git] / libringbuffer / ring_buffer_frontend.c
index ee205e86fbf0389b06d7bee31f8f59e55cb5db5a..7dab1594c3061a178d0c279e7f2c5fdb19d7eefd 100644 (file)
@@ -456,6 +456,8 @@ struct shm_handle *channel_create(const struct lib_ring_buffer_config *config,
                shmsize += sizeof(struct lib_ring_buffer_shmp);
 
        shmobj = shm_object_table_append(handle->table, shmsize);
+       if (!shmobj)
+               goto error_append;
        set_shmp(handle->chan, zalloc_shm(shmobj, sizeof(struct channel)));
        chan = shmp(handle, handle->chan);
        if (!chan)
@@ -567,20 +569,31 @@ void *channel_destroy(struct channel *chan, struct shm_handle *handle)
         * sessiond/consumer are keeping a reference on the shm file
         * descriptor directly. No need to refcount.
         */
-       channel_release(chan, handle);
        priv = chan->backend.priv;
+       channel_release(chan, handle);
        return priv;
 }
 
 struct lib_ring_buffer *channel_get_ring_buffer(
                                        const struct lib_ring_buffer_config *config,
                                        struct channel *chan, int cpu,
-                                       struct shm_handle *handle)
+                                       struct shm_handle *handle,
+                                       int *shm_fd, int *wait_fd,
+                                       uint64_t *memory_map_size)
 {
-       if (config->alloc == RING_BUFFER_ALLOC_GLOBAL)
+       struct shm_ref *ref;
+
+       if (config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
+               ref = &chan->backend.buf[0].shmp._ref;
+               shm_get_object_data(handle, ref, shm_fd, wait_fd,
+                       memory_map_size);
                return shmp(handle, chan->backend.buf[0].shmp);
-       else
+       } else {
+               ref = &chan->backend.buf[cpu].shmp._ref;
+               shm_get_object_data(handle, ref, shm_fd, wait_fd,
+                       memory_map_size);
                return shmp(handle, chan->backend.buf[cpu].shmp);
+       }
 }
 
 int lib_ring_buffer_open_read(struct lib_ring_buffer *buf,
This page took 0.024343 seconds and 4 git commands to generate.