X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=libust%2Ftracer.c;h=5f9aa69ffe2d8531f1c88bed35eb910b82b709ae;hb=1518fa0fad67101416c2def6b1c88ec767e8b5eb;hp=d5ec43e8356c2e527bc5642cc301fe1edb273770;hpb=b73a4c471dc987ea8548632dffb3c7050de77dd0;p=lttng-ust.git diff --git a/libust/tracer.c b/libust/tracer.c index d5ec43e8..5f9aa69f 100644 --- a/libust/tracer.c +++ b/libust/tracer.c @@ -630,6 +630,11 @@ int ltt_trace_alloc(const char *trace_name) ltt_lock_traces(); + if (_ltt_trace_find(trace_name)) { /* Trace already allocated */ + err = 1; + goto traces_error; + } + trace = _ltt_trace_find_setup(trace_name); if (!trace) { ERR("Trace not found %s", trace_name); @@ -779,15 +784,17 @@ traces_error: } /* Sleepable part of the destroy */ -static void __ltt_trace_destroy(struct ust_trace *trace) +static void __ltt_trace_destroy(struct ust_trace *trace, int drop) { int i; struct ust_channel *chan; - for (i = 0; i < trace->nr_channels; i++) { - chan = &trace->channels[i]; - if (chan->active) - trace->ops->finish_channel(chan); + if(!drop) { + for (i = 0; i < trace->nr_channels; i++) { + chan = &trace->channels[i]; + if (chan->active) + trace->ops->finish_channel(chan); + } } return; /* FIXME: temporary for ust */ @@ -822,7 +829,7 @@ static void __ltt_trace_destroy(struct ust_trace *trace) kref_put(&trace->kref, ltt_release_trace); } -int ltt_trace_destroy(const char *trace_name) +int ltt_trace_destroy(const char *trace_name, int drop) { int err = 0; struct ust_trace *trace; @@ -837,7 +844,7 @@ int ltt_trace_destroy(const char *trace_name) ltt_unlock_traces(); - __ltt_trace_destroy(trace); + __ltt_trace_destroy(trace, drop); //ust// put_trace_clock(); return 0;