From c88f762e4c83e3ff148f8e7962d3d9c52d64ff4e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Genevi=C3=A8ve=20Bastien?= Date: Thu, 1 Feb 2018 12:18:26 -0500 Subject: [PATCH] metadata: Add the product uuid to the 'env' section MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The product UUID is taken from the DMI system information and can be used to identify a machine's hardware (virtual or physical). Signed-off-by: Geneviève Bastien Signed-off-by: Mathieu Desnoyers --- lttng-events.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lttng-events.c b/lttng-events.c index 38cd4447..4588153b 100644 --- a/lttng-events.c +++ b/lttng-events.c @@ -28,6 +28,7 @@ #include #include #include +#include #include /* for wrapper_vmalloc_sync_all() */ #include @@ -2542,6 +2543,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session) { unsigned char *uuid_c = session->uuid.b; unsigned char uuid_s[37], clock_uuid_s[BOOT_ID_LEN]; + const char *product_uuid; struct lttng_channel *chan; struct lttng_event *event; int ret = 0; @@ -2628,7 +2630,18 @@ int _lttng_session_metadata_statedump(struct lttng_session *session) if (ret) goto end; - /* Close env */ + /* Add the product UUID to the 'env' section */ + product_uuid = dmi_get_system_info(DMI_PRODUCT_UUID); + if (product_uuid) { + ret = lttng_metadata_printf(session, + " product_uuid = \"%s\";\n", + product_uuid + ); + if (ret) + goto end; + } + + /* Close the 'env' section */ ret = lttng_metadata_printf(session, "};\n\n"); if (ret) goto end; -- 2.34.1