/* 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);
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--;
+ }
+}
int kernel_calibrate(int fd, struct lttng_kernel_calibrate *calibrate);
int kernel_validate_version(int tracer_fd);
void kernel_destroy_session(struct ltt_kernel_session *ksess);
+void kernel_destroy_channel(struct ltt_kernel_channel *kchan);
int init_kernel_workarounds(void);
struct ltt_kernel_event_list events_list;
struct ltt_kernel_stream_list stream_list;
struct cds_list_head list;
+ /* Session pointer which has a reference to this object. */
+ struct ltt_kernel_session *session;
};
/* Metadata */