lttng-abi: Document ioctl numbers reserved by lttng-abi-old.h
[lttng-modules.git] / lttng-events.c
index 2e7670b8c9d4b59d05c2fb02568326921da7bc3f..4588153bf2d76a3f1fe8190a9119b69285ca0b6c 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/uaccess.h>
 #include <linux/vmalloc.h>
 #include <linux/uuid.h>
+#include <linux/dmi.h>
 
 #include <wrapper/vmalloc.h>   /* for wrapper_vmalloc_sync_all() */
 #include <wrapper/random.h>
@@ -2514,15 +2515,16 @@ error:
 }
 
 static
-int print_metadata_session_name(struct lttng_session *session)
+int print_metadata_escaped_field(struct lttng_session *session, const char *field,
+               const char *field_value)
 {
        int ret;
 
-       ret = lttng_metadata_printf(session, "  trace_name = \"");
+       ret = lttng_metadata_printf(session, "  %s = \"", field);
        if (ret)
                goto error;
 
-       ret = print_escaped_ctf_string(session, session->name);
+       ret = print_escaped_ctf_string(session, field_value);
        if (ret)
                goto error;
 
@@ -2541,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;
@@ -2619,11 +2622,26 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
        if (ret)
                goto end;
 
-       ret = print_metadata_session_name(session);
+       ret = print_metadata_escaped_field(session, "trace_name", session->name);
        if (ret)
                goto end;
+       ret = print_metadata_escaped_field(session, "trace_creation_datetime",
+                       session->creation_time);
+       if (ret)
+               goto end;
+
+       /* 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 env */
+       /* Close the 'env' section */
        ret = lttng_metadata_printf(session, "};\n\n");
        if (ret)
                goto end;
This page took 0.02455 seconds and 4 git commands to generate.