[ltt-dev] [PATCH] Make ltt_trace_start return error when trace_name not exist

Zhaolei zhaolei at cn.fujitsu.com
Thu Oct 16 03:46:44 EDT 2008


Hi Mathieu,

I find ltt_trace_start don't return error when trace_name is not exist.
So, when we use lttctl -s to start no-exist channel, it will not print
 any errormsg:
  # ls /mnt/debugfs/ltt/
  # lttctl -n zltest -s
  Linux Trace Toolkit Trace Control 0.54-10102008
  
  Controlling trace : zltest
  
  # ls /mnt/debugfs/ltt/
  #

It can be fixed by following patch, I tested patched kernel with following command:
  # ls /mnt/debugfs/ltt/
  # lttctl -n zltest -s
  Linux Trace Toolkit Trace Control 0.54-10102008
  
  Controlling trace : zltest
  
  Start Trace Error: No such file or directory
  #

Signed-off-by: Zhaolei <zhaolei at cn.fujitsu.com>
---
 ltt/ltt-tracer.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ltt/ltt-tracer.c b/ltt/ltt-tracer.c
index 0d0423d..bc8251b 100644
--- a/ltt/ltt-tracer.c
+++ b/ltt/ltt-tracer.c
@@ -641,9 +641,10 @@ static int ltt_trace_start(char *trace_name)
 	ltt_lock_traces();
 
 	trace = _ltt_trace_find(trace_name);
-	if (trace == NULL)
-		goto no_trace;
 	err = _ltt_trace_start(trace);
+	if (err) {
+		goto no_trace;
+	}
 
 	ltt_unlock_traces();
 
-- 
1.5.5.3






More information about the lttng-dev mailing list