Add get mmap base
[lttng-ust.git] / libustctl / ustctl.c
index 3d886d3305c569f7df4092ae90ec076a932e0695..735e63cb6f7d2cb58f182585b07620b087df8457 100644 (file)
@@ -444,8 +444,47 @@ int ustctl_add_stream(struct shm_handle *handle,
        return 0;
 }
 
+void ustctl_unmap_channel(struct shm_handle *handle)
+{
+       struct channel *chan;
+
+       chan = shmp(handle, handle->chan);
+       channel_destroy(chan, handle, 1);
+}
+
+struct lib_ring_buffer *ustctl_open_stream_read(struct shm_handle *handle,
+       int cpu)
+{
+       struct channel *chan = handle->shadow_chan;
+       int shm_fd, wait_fd;
+       uint64_t memory_map_size;
+       struct lib_ring_buffer *buf;
+       int ret;
+
+       buf = channel_get_ring_buffer(&chan->backend.config,
+               chan, cpu, handle, &shm_fd, &wait_fd, &memory_map_size);
+       if (!buf)
+               return NULL;
+       ret = lib_ring_buffer_open_read(buf, handle, 1);
+       if (ret)
+               return NULL;
+       return buf;
+}
+
+void ustctl_close_stream_read(struct shm_handle *handle,
+               struct lib_ring_buffer *buf)
+{
+       lib_ring_buffer_release_read(buf, handle, 1);
+}
+
 /* For mmap mode, readable without "get" operation */
 
+void *ustctl_get_mmap_base(struct shm_handle *handle,
+               struct lib_ring_buffer *buf)
+{
+       return shmp(handle, buf->backend.memory_map);
+}
+
 /* returns the length to mmap. */
 int ustctl_get_mmap_len(struct shm_handle *handle,
                struct lib_ring_buffer *buf,
This page took 0.023598 seconds and 4 git commands to generate.