Allow optional snapshot name and max_size
[lttng-tools.git] / src / common / config / session-config.c
index e5afc4abc185e1f62007f20439cea188375ab27f..750eb948b96bfa6f9f8d69a9793c66bf0f21520c 100644 (file)
@@ -1218,7 +1218,7 @@ int create_snapshot_session(const char *session_name, xmlNodePtr output_node)
                        snapshot_output_node; snapshot_output_node =
                        xmlNextElementSibling(snapshot_output_node)) {
                char *name = NULL;
-               uint64_t max_size = UINT64_MAX;
+               uint64_t max_size = DEFAULT_SNAPSHOT_MAX_SIZE;
                struct consumer_output output = { 0 };
                struct lttng_snapshot_output *snapshot_output = NULL;
 
@@ -1262,6 +1262,18 @@ int create_snapshot_session(const char *session_name, xmlNodePtr output_node)
                        goto error_snapshot_output;
                }
 
+               if (!name) {
+                       /* Generate a default name */
+                       int pret;
+                       pret = asprintf(&name, DEFAULT_SNAPSHOT_NAME "-%" PRIu32,
+                                       lttng_snapshot_output_get_id(snapshot_output));
+                       if (pret < 0) {
+                               name = NULL;
+                               PERROR("snprintf output name");
+                               goto error_snapshot_output;
+                       }
+               }
+
                ret = lttng_snapshot_output_set_name(name, snapshot_output);
                if (ret) {
                        goto error_snapshot_output;
This page took 0.026707 seconds and 5 git commands to generate.