X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fkernel.c;h=b417cb07759c4f30795b9240508b31e2148ffd77;hp=3471fd940dc7f390f44d863fdd5447181360334a;hb=fb5f35b688fa31b21b25f9a6a831df3e5aa243ed;hpb=35f90c40cf023393851ac47ad526a0e9e1184503;ds=sidebyside diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c index 3471fd940..b417cb077 100644 --- a/src/bin/lttng-sessiond/kernel.c +++ b/src/bin/lttng-sessiond/kernel.c @@ -148,6 +148,7 @@ int kernel_create_channel(struct ltt_kernel_session *session, /* Add channel to session */ cds_list_add(&lkc->list, &session->channel_list.head); session->channel_count++; + lkc->session = session; DBG("Kernel channel %s created (fd: %d)", lkc->channel->name, lkc->fd); @@ -708,3 +709,33 @@ void kernel_destroy_session(struct ltt_kernel_session *ksess) trace_kernel_destroy_session(ksess); } + +/* + * Destroy a kernel channel object. It does not do anything on the tracer side. + */ +void kernel_destroy_channel(struct ltt_kernel_channel *kchan) +{ + struct ltt_kernel_session *ksess = NULL; + + assert(kchan); + assert(kchan->channel); + + DBG3("Kernel destroy channel %s", kchan->channel->name); + + /* Update channel count of associated session. */ + if (kchan->session) { + /* Keep pointer reference so we can update it after the destroy. */ + ksess = kchan->session; + } + + trace_kernel_destroy_channel(kchan); + + /* + * At this point the kernel channel is not visible anymore. This is safe + * since in order to work on a visible kernel session, the tracing session + * lock (ltt_session.lock) MUST be acquired. + */ + if (ksess) { + ksess->channel_count--; + } +}