fork: don't switch buffer when destroying trace in child
[ust.git] / libust / tracer.c
index d5ec43e8356c2e527bc5642cc301fe1edb273770..5f9aa69ffe2d8531f1c88bed35eb910b82b709ae 100644 (file)
@@ -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;
This page took 0.023304 seconds and 4 git commands to generate.