Cygwin: Introduce new LTTNG_UST_STREAM_PIPE command to open wakeup pipe
[lttng-ust.git] / liblttng-ust / ltt-ring-buffer-metadata-client.h
index 0e9b7fa3f2f3f544158f72b9aed48ca2526d764b..a8ba282d8cbebf1a8ed28677bb808bef3f164ee1 100644 (file)
@@ -207,6 +207,34 @@ struct ltt_channel *_channel_create(const char *name,
        return ltt_chan;
 }
 
+static
+int ltt_channel_open_pipe(struct channel *chan,
+                         struct lttng_ust_shm_handle *handle)
+{
+       struct shm_ref *ref;
+       int cpu = 0;
+
+       if (client_config.alloc == RING_BUFFER_ALLOC_GLOBAL) {
+               ref = &chan->backend.buf[0].shmp._ref;
+               return shm_open_wakeup_pipe(handle, ref);
+       } else {
+               if (cpu >= num_possible_cpus()) {
+                       goto error;
+               }
+
+               for_each_possible_cpu(cpu) {
+                       ref = &chan->backend.buf[cpu].shmp._ref;
+                       if (shm_open_wakeup_pipe(handle, ref) < 0) {
+                               goto error;
+                       }
+               }
+       }
+
+       return 0;
+error:
+       return -1;
+}
+
 static
 void ltt_channel_destroy(struct ltt_channel *ltt_chan)
 {
@@ -321,6 +349,7 @@ static struct ltt_transport ltt_relay_transport = {
        .name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING "-mmap",
        .ops = {
                .channel_create = _channel_create,
+               .channel_open_pipe = ltt_channel_open_pipe,
                .channel_destroy = ltt_channel_destroy,
                .buffer_read_open = ltt_buffer_read_open,
                .buffer_read_close = ltt_buffer_read_close,
This page took 0.025213 seconds and 4 git commands to generate.