+ int ret;
+ struct ltt_kernel_channel *lkc;
+ struct lttng_kernel_channel *chan;
+
+ lkc = malloc(sizeof(struct ltt_kernel_channel));
+ chan = malloc(sizeof(struct lttng_kernel_channel));
+ if (lkc == NULL || chan == NULL) {
+ perror("kernel channel malloc");
+ goto error;
+ }
+
+ /* Default value to channel */
+ chan->overwrite = DEFAULT_KERNEL_OVERWRITE;
+ chan->subbuf_size = DEFAULT_KERNEL_SUBBUF_SIZE;
+ chan->num_subbuf = DEFAULT_KERNEL_SUBBUF_NUM;
+ chan->switch_timer_interval = DEFAULT_KERNEL_SWITCH_TIMER;
+ chan->read_timer_interval = DEFAULT_KERNEL_READ_TIMER;
+
+ lkc->fd = 0;
+ lkc->stream_count = 0;
+ lkc->channel = chan;
+ /* Init linked list */
+ CDS_INIT_LIST_HEAD(&lkc->events_list.head);
+ CDS_INIT_LIST_HEAD(&lkc->stream_list.head);
+ /* Set default trace output path */
+ ret = asprintf(&lkc->pathname, "%s", DEFAULT_TRACE_OUTPUT);
+ if (ret < 0) {
+ perror("asprintf kernel create channel");
+ goto error;
+ }
+
+ return lkc;
+
+error:
+ return NULL;