X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Ftrace-ust.c;h=8d3c7dcf8e8e59f3962c991225b67174a5414d22;hp=657d6e554310f70fdbed57d72d9f7165daf5b768;hb=6b453b5e07e90591c955ae14c60c13b7c1ed28a0;hpb=10646003ec8dd54b76990cf335ef2bc56ab17a3e diff --git a/src/bin/lttng-sessiond/trace-ust.c b/src/bin/lttng-sessiond/trace-ust.c index 657d6e554..8d3c7dcf8 100644 --- a/src/bin/lttng-sessiond/trace-ust.c +++ b/src/bin/lttng-sessiond/trace-ust.c @@ -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 @@ -332,6 +340,7 @@ error: * Return pointer to structure or NULL. */ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev, + char *filter_expression, struct lttng_filter_bytecode *filter, struct lttng_event_exclusion *exclusion) { @@ -386,6 +395,7 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev, } /* Same layout. */ + lue->filter_expression = filter_expression; lue->filter = (struct lttng_ust_filter_bytecode *) filter; lue->exclusion = (struct lttng_event_exclusion *) exclusion; @@ -404,48 +414,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. * @@ -545,7 +513,9 @@ void trace_ust_destroy_event(struct ltt_ust_event *event) assert(event); DBG2("Trace destroy UST event %s", event->attr.name); + free(event->filter_expression); free(event->filter); + free(event->exclusion); free(event); } @@ -638,20 +608,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. */