Add ustctl_open_stream_read and ustctl_close_stream_read
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 22 Oct 2011 23:48:50 +0000 (19:48 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 22 Oct 2011 23:48:50 +0000 (19:48 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/ust/lttng-ust-ctl.h
libustctl/ustctl.c

index 58906a57626f1fb29b56b88edcfdf7f0ef5bc147..52c954aa64e3faad8a6d92dfa17c9c6fd2cc923a 100644 (file)
@@ -90,6 +90,12 @@ void ustctl_unmap_channel(struct shm_handle *shm_handle);
 struct shm_handle;
 struct lib_ring_buffer;
 
+/* Open/close stream buffers for read */
+struct lib_ring_buffer *ustctl_open_stream_read(struct shm_handle *handle,
+               int cpu);
+void ustctl_close_stream_read(struct shm_handle *handle,
+                struct lib_ring_buffer *buf);
+
 /* For mmap mode, readable without "get" operation */
 int ustctl_get_mmap_len(struct shm_handle *handle,
                struct lib_ring_buffer *buf,
index 581de965c573ad2610e53692786cda5b976b1f34..abe6d034bb4211f7941da8dcec40cb4a56325cbc 100644 (file)
@@ -452,6 +452,31 @@ void ustctl_unmap_channel(struct shm_handle *handle)
        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 */
 
 /* returns the length to mmap. */
This page took 0.042812 seconds and 4 git commands to generate.