}
/*
- * Disable recording for the channel for the kernel tracer.
+ * Disable channel.
+ *
+ * All tracing will be stopped for registered events of the channel.
*/
int lttng_disable_channel(struct lttng_domain *domain, const char *name)
{
- int ret = -1;
-
copy_string(lsm.u.disable.channel_name, name, NAME_MAX);
+ copy_lttng_domain(domain);
- if (domain) {
- switch (domain->type) {
- case LTTNG_DOMAIN_KERNEL:
- ret = ask_sessiond(LTTNG_KERNEL_DISABLE_CHANNEL, NULL);
- break;
- case LTTNG_DOMAIN_UST:
- ret = LTTCOMM_NOT_IMPLEMENTED;
- break;
- default:
- ret = LTTCOMM_UNKNOWN_DOMAIN;
- break;
- };
- }
-
- return ret;
+ return ask_sessiond(LTTNG_DISABLE_CHANNEL, NULL);
}
/*
enum lttcomm_sessiond_command {
/* Tracer context command */
LTTNG_ADD_CONTEXT,
- LTTNG_KERNEL_DISABLE_CHANNEL,
+ LTTNG_DISABLE_CHANNEL,
LTTNG_KERNEL_DISABLE_EVENT,
LTTNG_KERNEL_DISABLE_ALL_EVENT,
LTTNG_KERNEL_ENABLE_CHANNEL,
switch (cmd_ctx->lsm->cmd_type) {
case LTTNG_ADD_CONTEXT:
case LTTNG_KERNEL_DISABLE_ALL_EVENT:
- case LTTNG_KERNEL_DISABLE_CHANNEL:
+ case LTTNG_DISABLE_CHANNEL:
case LTTNG_KERNEL_DISABLE_EVENT:
case LTTNG_KERNEL_ENABLE_ALL_EVENT:
case LTTNG_KERNEL_ENABLE_CHANNEL:
default:
/* TODO: Userspace tracing */
ret = LTTCOMM_NOT_IMPLEMENTED;
+ goto error;
}
ret = LTTCOMM_OK;
break;
}
- case LTTNG_KERNEL_DISABLE_CHANNEL:
+ case LTTNG_DISABLE_CHANNEL:
{
- struct ltt_kernel_channel *chan;
+ struct ltt_kernel_channel *kchan;
/* Setup lttng message with no payload */
ret = setup_lttng_msg(cmd_ctx, 0);
goto setup_error;
}
- chan = get_kernel_channel_by_name(cmd_ctx->lsm->u.disable.channel_name,
- cmd_ctx->session->kernel_session);
- if (chan == NULL) {
- ret = LTTCOMM_KERN_CHAN_NOT_FOUND;
- goto error;
- } else if (chan->enabled == 1) {
- ret = kernel_disable_channel(chan);
- if (ret < 0) {
- if (ret != EEXIST) {
- ret = LTTCOMM_KERN_CHAN_DISABLE_FAIL;
- }
+ switch (cmd_ctx->lsm->domain.type) {
+ case LTTNG_DOMAIN_KERNEL:
+ kchan = get_kernel_channel_by_name(cmd_ctx->lsm->u.disable.channel_name,
+ cmd_ctx->session->kernel_session);
+ if (kchan == NULL) {
+ ret = LTTCOMM_KERN_CHAN_NOT_FOUND;
goto error;
+ } else if (kchan->enabled == 1) {
+ ret = kernel_disable_channel(kchan);
+ if (ret < 0) {
+ if (ret != EEXIST) {
+ ret = LTTCOMM_KERN_CHAN_DISABLE_FAIL;
+ }
+ goto error;
+ }
}
+ kernel_wait_quiescent(kernel_tracer_fd);
+ break;
+ default:
+ /* TODO: Userspace tracing */
+ ret = LTTCOMM_NOT_IMPLEMENTED;
+ goto error;
}
- kernel_wait_quiescent(kernel_tracer_fd);
ret = LTTCOMM_OK;
break;
}