X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=2a61eee064f5af2fa558e73db87f2057fd8eb120;hb=1148bd3a82f9819f3e59b9ce2b3adc139de9db45;hp=cca25992313cd8c48f5f049d717cff73e6a41045;hpb=92d28f51315353f6c9085de290e06f0e30c2b1ef;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index cca259923..2a61eee06 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1583,6 +1583,7 @@ error: 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; @@ -1598,6 +1599,21 @@ int cmd_start_trace(struct ltt_session *session) 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 */