aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>2010-06-29 02:06:18 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-06-29 09:21:11 -0400
commit68781c924a424c5a96fb33d50b2ed9d4cb4f49c8 (patch)
treef7bba794c2d75b8a9201df5461ee65e2f2a97864
parent6c72dffac3bd76d3570d7917a97dff40e3357b93 (diff)
trace-cmd: Add option to ignore event not found error
Currently, if 'trace-cmd start' passes an event that is not found it will cause the command to fail. This can be a problem for an administrator using trace-cmd on several machines that have different modules configured in. One script may be used that has all the events to be traced, but some of the events may not exist on all machines. This means each machine will need its own separate script. Instead of having a separate script, add a '-i' option that lets one ignore failed events. Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> LKML-Reference: <20100629144832.38C6.A69D9226@jp.fujitsu.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-cmd.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/trace-cmd.c b/trace-cmd.c
index cdb0735..b4eb0fe 100644
--- a/trace-cmd.c
+++ b/trace-cmd.c
@@ -113,6 +113,8 @@ struct events {
113 113
114static struct tracecmd_recorder *recorder; 114static struct tracecmd_recorder *recorder;
115 115
116static int ignore_event_not_found = 0;
117
116static char *get_temp_file(int cpu) 118static char *get_temp_file(int cpu)
117{ 119{
118 char *file = NULL; 120 char *file = NULL;
@@ -738,7 +740,7 @@ static void update_event(const char *name, const char *filter,
738 740
739 ret = update_glob(str, filter, filter_only, update); 741 ret = update_glob(str, filter, filter_only, update);
740 free(str); 742 free(str);
741 if (!ret) 743 if (!ret && !ignore_event_not_found)
742 die("No events enabled with %s", name); 744 die("No events enabled with %s", name);
743 return; 745 return;
744 } 746 }
@@ -752,7 +754,7 @@ static void update_event(const char *name, const char *filter,
752 ret2 = update_glob(str, filter, filter_only, update); 754 ret2 = update_glob(str, filter, filter_only, update);
753 free(str); 755 free(str);
754 756
755 if (!ret && !ret2) 757 if (!ret && !ret2 && !ignore_event_not_found)
756 goto fail; 758 goto fail;
757 759
758 return; 760 return;
@@ -1431,7 +1433,7 @@ int main (int argc, char **argv)
1431 (strcmp(argv[1], "start") == 0) || 1433 (strcmp(argv[1], "start") == 0) ||
1432 ((extract = strcmp(argv[1], "extract") == 0))) { 1434 ((extract = strcmp(argv[1], "extract") == 0))) {
1433 1435
1434 while ((c = getopt(argc-1, argv+1, "+he:f:Fp:do:O:s:r:vg:l:n:P:N:tb:k")) >= 0) { 1436 while ((c = getopt(argc-1, argv+1, "+he:f:Fp:do:O:s:r:vg:l:n:P:N:tb:ki")) >= 0) {
1435 switch (c) { 1437 switch (c) {
1436 case 'h': 1438 case 'h':
1437 usage(argv); 1439 usage(argv);
@@ -1543,6 +1545,9 @@ int main (int argc, char **argv)
1543 case 'k': 1545 case 'k':
1544 keep = 1; 1546 keep = 1;
1545 break; 1547 break;
1548 case 'i':
1549 ignore_event_not_found = 1;
1550 break;
1546 } 1551 }
1547 } 1552 }
1548 1553