LTTNG_ERR_UST_CONSUMER32_FAIL = 69, /* 32-bit UST consumer start failed */
LTTNG_ERR_UST_STREAM_FAIL = 70, /* UST create stream failed */
LTTNG_ERR_SNAPSHOT_NODATA = 71, /* No data in snapshot. */
- /* 72 */
+ LTTNG_ERR_NO_CHANNEL = 72, /* No channel found in the session. */
/* 73 */
LTTNG_ERR_UST_LIST_FAIL = 74, /* UST listing events failed */
LTTNG_ERR_UST_EVENT_EXIST = 75, /* UST event exist */
int cmd_start_trace(struct ltt_session *session)
{
int ret;
+ unsigned long nb_chan = 0;
struct ltt_kernel_session *ksession;
struct ltt_ust_session *usess;
goto error;
}
+ /*
+ * Starting a session without channel is useless since after that it's not
+ * possible to enable channel thus inform the client.
+ */
+ if (usess && usess->domain_global.channels) {
+ nb_chan += lttng_ht_get_count(usess->domain_global.channels);
+ }
+ if (ksession) {
+ nb_chan += ksession->channel_count;
+ }
+ if (!nb_chan) {
+ ret = LTTNG_ERR_NO_CHANNEL;
+ goto error;
+ }
+
session->enabled = 1;
/* Kernel tracing */
[ ERROR_INDEX(LTTNG_ERR_SNAPSHOT_FAIL) ] = "Snapshot record failed",
[ ERROR_INDEX(LTTNG_ERR_CHAN_EXIST) ] = "Channel already exists",
[ ERROR_INDEX(LTTNG_ERR_SNAPSHOT_NODATA) ] = "No data available in snapshot",
+ [ ERROR_INDEX(LTTNG_ERR_NO_CHANNEL) ] = "No channel found in the session",
/* Last element */
[ ERROR_INDEX(LTTNG_ERR_NR) ] = "Unknown error code"