+ * Set default channel attributes.
+ */
+void lttng_channel_set_default_attr(struct lttng_domain *domain,
+ struct lttng_channel_attr *attr)
+{
+ /* Safety check */
+ if (attr == NULL || domain == NULL) {
+ return;
+ }
+
+ switch (domain->type) {
+ case LTTNG_DOMAIN_KERNEL:
+ attr->overwrite = DEFAULT_CHANNEL_OVERWRITE;
+ attr->switch_timer_interval = DEFAULT_CHANNEL_SWITCH_TIMER;
+ attr->read_timer_interval = DEFAULT_CHANNEL_READ_TIMER;
+
+ attr->subbuf_size = DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE;
+ attr->num_subbuf = DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM;
+ attr->output = DEFAULT_KERNEL_CHANNEL_OUTPUT;
+ break;
+ case LTTNG_DOMAIN_UST:
+ case LTTNG_DOMAIN_UST_EXEC_NAME:
+ case LTTNG_DOMAIN_UST_PID:
+ case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN:
+ attr->overwrite = DEFAULT_CHANNEL_OVERWRITE;
+ attr->switch_timer_interval = DEFAULT_CHANNEL_SWITCH_TIMER;
+ attr->read_timer_interval = DEFAULT_CHANNEL_READ_TIMER;
+
+ attr->subbuf_size = DEFAULT_UST_CHANNEL_SUBBUF_SIZE;
+ attr->num_subbuf = DEFAULT_UST_CHANNEL_SUBBUF_NUM;
+ attr->output = DEFAULT_UST_CHANNEL_OUTPUT;
+ break;
+ default:
+ /* Default behavior */
+ memset(attr, 0, sizeof(struct lttng_channel_attr));
+ break;
+ }
+}
+
+/*
+ * Check if session daemon is alive.