error:
if (lks) {
trace_kernel_destroy_session(lks);
+ trace_kernel_free_session(lks);
}
return ret;
}
}
/*
- * Complete teardown of a kernel session.
+ * Teardown of a kernel session, keeping data required by destroy notifiers.
*/
void kernel_destroy_session(struct ltt_kernel_session *ksess)
{
lttng_trace_chunk_put(trace_chunk);
}
+/* Teardown of data required by destroy notifiers. */
+void kernel_free_session(struct ltt_kernel_session *ksess)
+{
+ if (ksess == NULL) {
+ return;
+ }
+ trace_kernel_free_session(ksess);
+}
+
/*
* Destroy a kernel channel object. It does not do anything on the tracer side.
*/
struct lttng_kernel_tracer_version *kernel_tracer_version,
struct lttng_kernel_tracer_abi_version *kernel_tracer_abi_version);
void kernel_destroy_session(struct ltt_kernel_session *ksess);
+void kernel_free_session(struct ltt_kernel_session *ksess);
void kernel_destroy_channel(struct ltt_kernel_channel *kchan);
enum lttng_error_code kernel_snapshot_record(
struct ltt_kernel_session *ksess,
usess = session->ust_session;
ksess = session->kernel_session;
- /* Clean kernel session teardown */
+ /* Clean kernel session teardown, keeping data for destroy notifier. */
kernel_destroy_session(ksess);
- session->kernel_session = NULL;
- /* UST session teardown */
+ /* UST session teardown, keeping data for destroy notifier. */
if (usess) {
/* Close any relayd session */
consumer_output_send_destroy_relayd(usess->consumer);
ERR("Error in ust_app_destroy_trace_all");
}
- /* Clean up the rest. */
+ /* Clean up the rest, keeping destroy notifier data. */
trace_ust_destroy_session(usess);
- session->ust_session = NULL;
}
/*
del_session_ht(session);
}
session_notify_destruction(session);
+
+ kernel_free_session(ksess);
+ session->kernel_session = NULL;
+ if (usess) {
+ trace_ust_free_session(usess);
+ session->ust_session = NULL;
+ }
lttng_dynamic_array_reset(&session->destroy_notifiers);
free(session->last_archived_chunk_name);
free(session);
cds_list_for_each_entry_safe(channel, ctmp, &session->channel_list.head, list) {
trace_kernel_destroy_channel(channel);
}
+}
+/* Free elements needed by destroy notifiers. */
+void trace_kernel_free_session(struct ltt_kernel_session *session)
+{
/* Wipe consumer output object */
consumer_output_put(session->consumer);
void trace_kernel_destroy_event(struct ltt_kernel_event *event);
void trace_kernel_destroy_stream(struct ltt_kernel_stream *stream);
void trace_kernel_destroy_context(struct ltt_kernel_context *ctx);
+void trace_kernel_free_session(struct ltt_kernel_session *session);
#endif /* _LTT_TRACE_KERNEL_H */
}
/*
- * Cleanup ust session structure
+ * Cleanup ust session structure, keeping data required by
+ * destroy notifier.
*
* Should *NOT* be called with RCU read-side lock held.
*/
buffer_reg_uid_destroy(reg, session->consumer);
}
- consumer_output_put(session->consumer);
-
fini_pid_tracker(&session->pid_tracker);
lttng_trace_chunk_put(session->current_trace_chunk);
+}
+
+/* Free elements needed by destroy notifiers. */
+void trace_ust_free_session(struct ltt_ust_session *session)
+{
+ consumer_output_put(session->consumer);
free(session);
}
void trace_ust_destroy_channel(struct ltt_ust_channel *channel);
void trace_ust_destroy_event(struct ltt_ust_event *event);
void trace_ust_destroy_context(struct ltt_ust_context *ctx);
+void trace_ust_free_session(struct ltt_ust_session *session);
int trace_ust_track_pid(struct ltt_ust_session *session, int pid);
int trace_ust_untrack_pid(struct ltt_ust_session *session, int pid);
void trace_ust_destroy_event(struct ltt_ust_event *event)
{
}
+
+static inline
+void trace_ust_free_session(struct ltt_ust_session *session)
+{
+}
+
static inline
struct ltt_ust_context *trace_ust_create_context(
struct lttng_event_context *ctx)