attr = defattr;
}
+ /*
+ * Validate UST buffer size and number of buffers: must both be
+ * power of 2 and nonzero. We validate right here for UST,
+ * because applications will not report the error to the user
+ * (unlike kernel tracing).
+ */
+ if (!attr->attr.subbuf_size || (attr->attr.subbuf_size & (attr->attr.subbuf_size - 1))) {
+ ret = LTTCOMM_INVALID;
+ goto error;
+ }
+ if (!attr->attr.num_subbuf || (attr->attr.num_subbuf & (attr->attr.num_subbuf - 1))) {
+ ret = LTTCOMM_INVALID;
+ goto error;
+ }
+
/* Create UST channel */
uchan = trace_ust_create_channel(attr, usess->pathname);
if (uchan == NULL) {
[ LTTCOMM_ERR_INDEX(CONSUMERD_SPLICE_ENOMEM) ] = "consumerd splice ENOMEM",
[ LTTCOMM_ERR_INDEX(CONSUMERD_SPLICE_ESPIPE) ] = "consumerd splice ESPIPE",
[ LTTCOMM_ERR_INDEX(LTTCOMM_NO_EVENT) ] = "Event not found",
+ [ LTTCOMM_ERR_INDEX(LTTCOMM_INVALID) ] = "Invalid parameter",
};
/*
CONSUMERD_SPLICE_EINVAL, /* EINVAL from splice(2) */
CONSUMERD_SPLICE_ENOMEM, /* ENOMEM from splice(2) */
CONSUMERD_SPLICE_ESPIPE, /* ESPIPE from splice(2) */
+ LTTCOMM_INVALID, /* Invalid parameter */
/* MUST be last element */
LTTCOMM_NR, /* Last element */