[lttng-dev] [LTTNG-TOOLS PATCH 3/9] Reference pointers from ust_app_chan to parent structs

Julien Desfossez jdesfossez at efficios.com
Mon Jul 13 11:28:03 EDT 2015


To extract the lost packets and discarded events counters in per-pid
channels when an application unregisters, we need a reference to the
parent channel and session. These pointers are only there as reference
and do not provide any kind of ownership.

Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
 src/bin/lttng-sessiond/ust-app.c | 5 +++++
 src/bin/lttng-sessiond/ust-app.h | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
index 6f032da..08b6a76 100644
--- a/src/bin/lttng-sessiond/ust-app.c
+++ b/src/bin/lttng-sessiond/ust-app.c
@@ -1702,6 +1702,11 @@ static void shadow_copy_session(struct ust_app_session *ua_sess,
 		 * channel and not metadata.
 		 */
 		ua_chan->attr.type = LTTNG_UST_CHAN_PER_CPU;
+		/*
+		 * Back pointers to the ust session and channel.
+		 */
+		ua_chan->usess = usess;
+		ua_chan->uchan = uchan;
 
 		lttng_ht_add_unique_str(ua_sess->channels, &ua_chan->node);
 	}
diff --git a/src/bin/lttng-sessiond/ust-app.h b/src/bin/lttng-sessiond/ust-app.h
index 66cda8c..38eaf6d 100644
--- a/src/bin/lttng-sessiond/ust-app.h
+++ b/src/bin/lttng-sessiond/ust-app.h
@@ -168,6 +168,12 @@ struct ust_app_channel {
 	struct lttng_ht_node_ulong ust_objd_node;
 	/* For delayed reclaim */
 	struct rcu_head rcu_head;
+	/*
+	 * Back pointers to the parent channel and session, no ownership,
+	 * just references.
+	 */
+	struct ltt_ust_channel *uchan;
+	struct ltt_ust_session *usess;
 };
 
 struct ust_app_session {
-- 
1.9.1




More information about the lttng-dev mailing list