+static int channel_validate(struct lttng_channel *attr)
+{
+ /*
+ * The ringbuffer (both in user space and kernel) behaves badly
+ * in overwrite mode and with less than 2 subbuffers so block it
+ * right away and send back an invalid attribute error.
+ */
+ if (attr->attr.overwrite && attr->attr.num_subbuf < 2) {
+ return -1;
+ }
+ return 0;
+}
+
+static int channel_validate_kernel(struct lttng_channel *attr)
+{
+ /* Kernel channels do not support blocking timeout. */
+ if (((struct lttng_channel_extended *)attr->attr.extended.ptr)->blocking_timeout) {
+ return -1;
+ }
+ return 0;
+}
+