[ltt-dev] PATCH] Make lttcrl/lttd show error when channel not exist
Zhaolei
zhaolei at cn.fujitsu.com
Tue Oct 21 01:39:21 EDT 2008
Hello, Mathieu
When run lttctl with a no-exist debugfs's channel dir,
it don't report error:
# lttctl -n channel1 -d -l /no_exist -t /tmp/channel1
Linux Trace Toolkit Trace Control 0.54-10102008
Controlling trace : channel1
Linux Trace Toolkit Trace Daemon 0.54-10102008
Reading from debugfs directory : /no_exist/channel1
Writing to trace directory : /tmp/channel1
#
It is because lttd don't return error in daemon mode:
# lttd -d -t /tmp/channel1 -c /no_exist
Linux Trace Toolkit Trace Daemon 0.54-10102008
Reading from debugfs directory : /no_exist
Writing to trace directory : /tmp/channel1
# echo $?
0
#
I moved daemon() after channels_init() and make it seems fixed.
I tested patched program and haven't found problem:
# lttctl -n channel1 -d -l /no_exist -t /tmp/channel1
Linux Trace Toolkit Trace Control 0.54-10102008
Controlling trace : channel1
Linux Trace Toolkit Trace Daemon 0.54-10102008
Reading from debugfs directory : /no_exist/channel1
Writing to trace directory : /tmp/channel1
/no_exist/channel1: No such file or directory
Trace start error
#
#
# lttd -d -t /tmp/channel1 -c /no_exist
Linux Trace Toolkit Trace Daemon 0.54-10102008
Reading from debugfs directory : /no_exist
Writing to trace directory : /tmp/channel1
/no_exist: No such file or directory
#
#
# lttctl -n channel1 -d -l /mnt/debugfs/ltt/ -t /tmp/channel1
Linux Trace Toolkit Trace Control 0.54-10102008
Controlling trace : channel1
Linux Trace Toolkit Trace Daemon 0.54-10102008
Reading from debugfs directory : /mnt/debugfs/ltt//channel1
Writing to trace directory : /tmp/channel1
Creating trace subdirectory /tmp/channel1
Adding inotify for channel /mnt/debugfs/ltt//channel1/
Added inotify for channel /mnt/debugfs/ltt//channel1/, wd 1
Channel file : /mnt/debugfs/ltt//channel1/cpu_0
Opening file.
Channel file : /mnt/debugfs/ltt//channel1/control
Entering channel subdirectory...
Creating trace subdirectory /tmp/channel1/control
Adding inotify for channel /mnt/debugfs/ltt//channel1/control/
Added inotify for channel /mnt/debugfs/ltt//channel1/control/, wd 2
Channel file : /mnt/debugfs/ltt//channel1/control/network_0
Opening file.
Channel file : /mnt/debugfs/ltt//channel1/control/modules_0
Opening file.
Channel file : /mnt/debugfs/ltt//channel1/control/processes_0
Opening file.
Channel file : /mnt/debugfs/ltt//channel1/control/interrupts_0
Opening file.
Channel file : /mnt/debugfs/ltt//channel1/control/metadata_0
Opening file.
#
Cound you review it?
Btw, this patch will make lttctl and lttv show more detail message, is it necessary to cut them?
Signed-off-by: Zhao Lei <zhaolei at cn.fujitsu.com>
---
diff -Nur ltt-control-0.54-10102008.org/lttd/lttd.c ltt-control-0.54-10102008/lttd/lttd.c
--- ltt-control-0.54-10102008.org/lttd/lttd.c 2008-10-15 15:29:54.000000000 +0800
+++ ltt-control-0.54-10102008/lttd/lttd.c 2008-10-21 13:15:06.000000000 +0800
@@ -911,15 +911,6 @@
show_info();
- if(daemon_mode) {
- ret = daemon(0, 0);
-
- if(ret == -1) {
- perror("An error occured while daemonizing.");
- exit(-1);
- }
- }
-
/* Connect the signal handlers */
act.sa_handler = handler;
act.sa_flags = 0;
@@ -934,6 +925,15 @@
if(ret = channels_init())
return ret;
+ if(daemon_mode) {
+ ret = daemon(0, 0);
+
+ if(ret == -1) {
+ perror("An error occured while daemonizing.");
+ exit(-1);
+ }
+ }
+
tids = malloc(sizeof(pthread_t) * num_threads);
for(i=0; i<num_threads; i++) {
More information about the lttng-dev
mailing list