/* 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);
int fd, pos, ret;
char *event;
size_t nbmem, count = 0;
- ssize_t size;
FILE *fp;
struct lttng_event *elist;
goto end;
}
- while ((size = fscanf(fp, "event { name = %m[^;]; };%n\n", &event, &pos)) == 1) {
+ while (fscanf(fp, "event { name = %m[^;]; };%n\n", &event, &pos) == 1) {
if (count >= nbmem) {
struct lttng_event *new_elist;
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--;
+ }
+}