X-Git-Url: http://git.lttng.org/?p=lttng-ust.git;a=blobdiff_plain;f=liblttng-ust%2Fltt-ring-buffer-client.h;h=0779348ac28fcebb60d697a2dba2175738d3aebd;hp=b896169e0f64d4257cd46844252e46764b063e4a;hb=616d3093e1c34557aca7e9f6149338f43cf91886;hpb=42100b84cec40d234370c7c95651141fb5a3ddbc diff --git a/liblttng-ust/ltt-ring-buffer-client.h b/liblttng-ust/ltt-ring-buffer-client.h index b896169e..0779348a 100644 --- a/liblttng-ust/ltt-ring-buffer-client.h +++ b/liblttng-ust/ltt-ring-buffer-client.h @@ -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,