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