+ /* Depending on the buffer type, a different channel key is used. */
+ if (ua_sess->buffer_type == LTTNG_BUFFER_PER_UID) {
+ chan_reg_key = ua_chan->tracing_channel_id;
+ } else {
+ chan_reg_key = ua_chan->key;
+ }
+
+ if (ua_chan->attr.type == LTTNG_UST_CHAN_METADATA) {
+ chan_id = -1U;
+ } else {
+ chan_reg = ust_registry_channel_find(registry, chan_reg_key);
+ assert(chan_reg);
+ chan_id = chan_reg->chan_id;
+ }
+
+ switch (ua_chan->attr.output) {
+ case LTTNG_UST_MMAP:
+ default:
+ output = LTTNG_EVENT_MMAP;
+ break;
+ }
+
+ consumer_init_ask_channel_comm_msg(&msg,
+ ua_chan->attr.subbuf_size,
+ ua_chan->attr.num_subbuf,
+ ua_chan->attr.overwrite,
+ ua_chan->attr.switch_timer_interval,
+ ua_chan->attr.read_timer_interval,
+ ua_sess->live_timer_interval,
+ output,
+ (int) ua_chan->attr.type,
+ ua_sess->tracing_id,
+ pathname,
+ ua_chan->name,
+ ua_sess->euid,
+ ua_sess->egid,
+ consumer->net_seq_index,
+ ua_chan->key,
+ registry->uuid,
+ chan_id,
+ ua_chan->tracefile_size,
+ ua_chan->tracefile_count,
+ ua_sess->id,
+ ua_sess->output_traces,
+ ua_sess->uid);
+
+ health_code_update();
+
+ ret = consumer_socket_send(socket, &msg, sizeof(msg));
+ if (ret < 0) {
+ goto error;
+ }
+
+ ret = consumer_recv_status_channel(socket, &key,
+ &ua_chan->expected_stream_count);
+ if (ret < 0) {
+ goto error;
+ }
+ /* Communication protocol error. */
+ assert(key == ua_chan->key);
+ /* We need at least one where 1 stream for 1 cpu. */
+ if (ua_sess->output_traces) {
+ assert(ua_chan->expected_stream_count > 0);
+ }