Fix: keep metadata channel attr in UST session
[lttng-tools.git] / src / bin / lttng-sessiond / trace-ust.c
index 657d6e554310f70fdbed57d72d9f7165daf5b768..996916558f8b3a0d5fd1c3d5945fe11783368d53 100644 (file)
@@ -220,6 +220,14 @@ struct ltt_ust_session *trace_ust_create_session(uint64_t session_id)
        lus->id = session_id;
        lus->start_trace = 0;
 
+       /* Set default metadata channel attribute. */
+       lus->metadata_attr.overwrite = DEFAULT_CHANNEL_OVERWRITE;
+       lus->metadata_attr.subbuf_size = default_get_metadata_subbuf_size();
+       lus->metadata_attr.num_subbuf = DEFAULT_METADATA_SUBBUF_NUM;
+       lus->metadata_attr.switch_timer_interval = DEFAULT_METADATA_SWITCH_TIMER;
+       lus->metadata_attr.read_timer_interval = DEFAULT_METADATA_READ_TIMER;
+       lus->metadata_attr.output = LTTNG_UST_MMAP;
+
        /*
         * Default buffer type. This can be changed through an enable channel
         * requesting a different type. Note that this can only be changed once
@@ -404,48 +412,6 @@ error:
        return NULL;
 }
 
-/*
- * Allocate and initialize a ust metadata.
- *
- * Return pointer to structure or NULL.
- */
-struct ltt_ust_metadata *trace_ust_create_metadata(char *path)
-{
-       int ret;
-       struct ltt_ust_metadata *lum;
-
-       assert(path);
-
-       lum = zmalloc(sizeof(struct ltt_ust_metadata));
-       if (lum == NULL) {
-               PERROR("ust metadata zmalloc");
-               goto error;
-       }
-
-       /* Set default attributes */
-       lum->attr.overwrite = DEFAULT_CHANNEL_OVERWRITE;
-       lum->attr.subbuf_size = default_get_metadata_subbuf_size();
-       lum->attr.num_subbuf = DEFAULT_METADATA_SUBBUF_NUM;
-       lum->attr.switch_timer_interval = DEFAULT_METADATA_SWITCH_TIMER;
-       lum->attr.read_timer_interval = DEFAULT_METADATA_READ_TIMER;
-       lum->attr.output = LTTNG_UST_MMAP;
-
-       lum->handle = -1;
-       /* Set metadata trace path */
-       ret = snprintf(lum->pathname, PATH_MAX, "%s/" DEFAULT_METADATA_NAME, path);
-       if (ret < 0) {
-               PERROR("asprintf ust metadata");
-               goto error_free_metadata;
-       }
-
-       return lum;
-
-error_free_metadata:
-       free(lum);
-error:
-       return NULL;
-}
-
 /*
  * Allocate and initialize an UST context.
  *
@@ -546,6 +512,7 @@ void trace_ust_destroy_event(struct ltt_ust_event *event)
 
        DBG2("Trace destroy UST event %s", event->attr.name);
        free(event->filter);
+       free(event->exclusion);
        free(event);
 }
 
@@ -638,20 +605,6 @@ void trace_ust_delete_channel(struct lttng_ht *ht,
        assert(!ret);
 }
 
-/*
- * Cleanup ust metadata structure.
- */
-void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata)
-{
-       assert(metadata);
-
-       if (!metadata->handle) {
-               return;
-       }
-       DBG2("Trace UST destroy metadata %d", metadata->handle);
-       free(metadata);
-}
-
 /*
  * Iterate over a hash table containing channels and cleanup safely.
  */
This page took 0.024818 seconds and 4 git commands to generate.