[lttng-dev] [Patch LTTng-tools v2 2/5] Receive the CTF global enumerations from ust by the session daemon

Geneviève Bastien gbastien+lttng at versatic.net
Tue Feb 11 16:40:49 EST 2014


The session daemon can receive the global type declarations coming with a
tracepoint. The global type declarations come after the tracepoint description
itself.

Signed-off-by: Geneviève Bastien <gbastien+lttng at versatic.net>
---
 src/bin/lttng-sessiond/lttng-ust-ctl.h |  4 +++-
 src/bin/lttng-sessiond/ust-app.c       | 13 +++++++++----
 src/bin/lttng-sessiond/ust-registry.c  | 10 +++++++---
 src/bin/lttng-sessiond/ust-registry.h  |  6 +++++-
 4 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/src/bin/lttng-sessiond/lttng-ust-ctl.h b/src/bin/lttng-sessiond/lttng-ust-ctl.h
index 41ed6c5..f52640d 100644
--- a/src/bin/lttng-sessiond/lttng-ust-ctl.h
+++ b/src/bin/lttng-sessiond/lttng-ust-ctl.h
@@ -400,7 +400,9 @@ int ustctl_recv_register_event(int sock,
 					 */
 	size_t *nr_fields,
 	struct ustctl_field **fields,
-	char **model_emf_uri);
+	char **model_emf_uri,
+	size_t *nr_global_type_decl,    /* global type declarations */
+	struct ustctl_global_type_decl **global_type_decl);
 
 /*
  * Returns 0 on success, negative error value on error.
diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
index 34d4c9b..e8015a1 100644
--- a/src/bin/lttng-sessiond/ust-app.c
+++ b/src/bin/lttng-sessiond/ust-app.c
@@ -4647,7 +4647,8 @@ error_rcu_unlock:
  */
 static int add_event_ust_registry(int sock, int sobjd, int cobjd, char *name,
 		char *sig, size_t nr_fields, struct ustctl_field *fields, int loglevel,
-		char *model_emf_uri)
+		char *model_emf_uri, size_t nr_global_type_decl,
+		struct ustctl_global_type_decl *global_type_decl)
 {
 	int ret, ret_code;
 	uint32_t event_id = 0;
@@ -4704,7 +4705,7 @@ static int add_event_ust_registry(int sock, int sobjd, int cobjd, char *name,
 	ret_code = ust_registry_create_event(registry, chan_reg_key,
 			sobjd, cobjd, name, sig, nr_fields, fields, loglevel,
 			model_emf_uri, ua_sess->buffer_type, &event_id,
-			app);
+			app, nr_global_type_decl, global_type_decl);
 
 	/*
 	 * The return value is returned to ustctl so in case of an error, the
@@ -4764,11 +4765,14 @@ int ust_app_recv_notify(int sock)
 		char name[LTTNG_UST_SYM_NAME_LEN], *sig, *model_emf_uri;
 		size_t nr_fields;
 		struct ustctl_field *fields;
+		size_t nr_global_type_decl;
+		struct ustctl_global_type_decl *global_type_decl;
 
 		DBG2("UST app ustctl register event received");
 
 		ret = ustctl_recv_register_event(sock, &sobjd, &cobjd, name, &loglevel,
-				&sig, &nr_fields, &fields, &model_emf_uri);
+				&sig, &nr_fields, &fields, &model_emf_uri,
+				&nr_global_type_decl, &global_type_decl);
 		if (ret < 0) {
 			if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
 				ERR("UST app recv event failed with ret %d", ret);
@@ -4785,7 +4789,8 @@ int ust_app_recv_notify(int sock)
 		 * to the this function.
 		 */
 		ret = add_event_ust_registry(sock, sobjd, cobjd, name, sig, nr_fields,
-				fields, loglevel, model_emf_uri);
+				fields, loglevel, model_emf_uri,
+				nr_global_type_decl, global_type_decl);
 		if (ret < 0) {
 			goto error;
 		}
diff --git a/src/bin/lttng-sessiond/ust-registry.c b/src/bin/lttng-sessiond/ust-registry.c
index dc49416..281ea7c 100644
--- a/src/bin/lttng-sessiond/ust-registry.c
+++ b/src/bin/lttng-sessiond/ust-registry.c
@@ -133,7 +133,8 @@ int validate_event_fields(size_t nr_fields, struct ustctl_field *fields,
 static struct ust_registry_event *alloc_event(int session_objd,
 		int channel_objd, char *name, char *sig, size_t nr_fields,
 		struct ustctl_field *fields, int loglevel, char *model_emf_uri,
-		struct ust_app *app)
+		struct ust_app *app, size_t nr_global_type_decl,
+		struct ustctl_global_type_decl *global_type_decl)
 {
 	struct ust_registry_event *event = NULL;
 
@@ -163,6 +164,8 @@ static struct ust_registry_event *alloc_event(int session_objd,
 		strncpy(event->name, name, sizeof(event->name));
 		event->name[sizeof(event->name) - 1] = '\0';
 	}
+	event->nr_global_type_decl = nr_global_type_decl;
+	event->global_type_decl = global_type_decl;
 	cds_lfht_node_init(&event->node.node);
 
 error:
@@ -249,7 +252,8 @@ int ust_registry_create_event(struct ust_registry_session *session,
 		uint64_t chan_key, int session_objd, int channel_objd, char *name,
 		char *sig, size_t nr_fields, struct ustctl_field *fields, int loglevel,
 		char *model_emf_uri, int buffer_type, uint32_t *event_id_p,
-		struct ust_app *app)
+		struct ust_app *app, size_t nr_global_type_decl,
+		struct ustctl_global_type_decl *global_type_decl)
 {
 	int ret;
 	uint32_t event_id;
@@ -286,7 +290,7 @@ int ust_registry_create_event(struct ust_registry_session *session,
 	}
 
 	event = alloc_event(session_objd, channel_objd, name, sig, nr_fields,
-			fields, loglevel, model_emf_uri, app);
+			fields, loglevel, model_emf_uri, app, nr_global_type_decl, global_type_decl);
 	if (!event) {
 		ret = -ENOMEM;
 		goto error_free;
diff --git a/src/bin/lttng-sessiond/ust-registry.h b/src/bin/lttng-sessiond/ust-registry.h
index f195b74..8b41c2a 100644
--- a/src/bin/lttng-sessiond/ust-registry.h
+++ b/src/bin/lttng-sessiond/ust-registry.h
@@ -137,6 +137,9 @@ struct ust_registry_event {
 	 * initialize the node and the event_name/signature for the match function.
 	 */
 	struct lttng_ht_node_u64 node;
+	/* Global type declarations needed by the event */
+	struct ustctl_global_type_decl *global_type_decl;
+	size_t nr_global_type_decl;
 };
 
 /*
@@ -226,7 +229,8 @@ int ust_registry_create_event(struct ust_registry_session *session,
 		uint64_t chan_key, int session_objd, int channel_objd, char *name,
 		char *sig, size_t nr_fields, struct ustctl_field *fields, int loglevel,
 		char *model_emf_uri, int buffer_type, uint32_t *event_id_p,
-		struct ust_app *app);
+		struct ust_app *app, size_t nr_global_type_decl,
+		struct ustctl_global_type_decl *global_type_decl);
 struct ust_registry_event *ust_registry_find_event(
 		struct ust_registry_channel *chan, char *name, char *sig);
 void ust_registry_destroy_event(struct ust_registry_channel *chan,
-- 
1.8.5.4




More information about the lttng-dev mailing list