- /* Kernel channels */
- if (session->kernel_session != NULL) {
- cds_list_for_each_entry(kchan,
- &session->kernel_session->channel_list.head, list) {
- /* Copy lttng_channel struct to array */
- memcpy(&channels[i], kchan->channel, sizeof(struct lttng_channel));
- channels[i].enabled = kchan->enabled;
+ switch (domain) {
+ case LTTNG_DOMAIN_KERNEL:
+ /* Kernel channels */
+ if (session->kernel_session != NULL) {
+ cds_list_for_each_entry(kchan,
+ &session->kernel_session->channel_list.head, list) {
+ /* Copy lttng_channel struct to array */
+ memcpy(&channels[i], kchan->channel, sizeof(struct lttng_channel));
+ channels[i].enabled = kchan->enabled;
+ i++;
+ }
+ }
+ break;
+ case LTTNG_DOMAIN_UST:
+ {
+ struct cds_lfht_iter iter;
+ struct ltt_ust_channel *uchan;
+
+ cds_lfht_for_each_entry(session->ust_session->domain_global.channels,
+ &iter, uchan, node) {
+ strncpy(channels[i].name, uchan->name, LTTNG_SYMBOL_NAME_LEN);
+ channels[i].attr.overwrite = uchan->attr.overwrite;
+ channels[i].attr.subbuf_size = uchan->attr.subbuf_size;
+ channels[i].attr.num_subbuf = uchan->attr.num_subbuf;
+ channels[i].attr.switch_timer_interval =
+ uchan->attr.switch_timer_interval;
+ channels[i].attr.read_timer_interval =
+ uchan->attr.read_timer_interval;
+ channels[i].attr.output = uchan->attr.output;
+ channels[i].enabled = uchan->enabled;