Cygwin: Introduce new LTTNG_UST_STREAM_PIPE command to open wakeup pipe
[lttng-ust.git] / liblttng-ust / ltt-ring-buffer-client.h
index b896169e0f64d4257cd46844252e46764b063e4a..0779348ac28fcebb60d697a2dba2175738d3aebd 100644 (file)
@@ -437,6 +437,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)
 {
@@ -571,6 +599,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.023276 seconds and 4 git commands to generate.