diff options
Diffstat (limited to 'trace-cmd.c')
-rw-r--r-- | trace-cmd.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/trace-cmd.c b/trace-cmd.c index 7c13264..93fcfb8 100644 --- a/trace-cmd.c +++ b/trace-cmd.c | |||
@@ -86,6 +86,13 @@ static struct func_list *filter_funcs; | |||
86 | static struct func_list *notrace_funcs; | 86 | static struct func_list *notrace_funcs; |
87 | static struct func_list *graph_funcs; | 87 | static struct func_list *graph_funcs; |
88 | 88 | ||
89 | struct opt_list { | ||
90 | struct opt_list *next; | ||
91 | const char *option; | ||
92 | }; | ||
93 | |||
94 | static struct opt_list *options; | ||
95 | |||
89 | struct event_list { | 96 | struct event_list { |
90 | struct event_list *next; | 97 | struct event_list *next; |
91 | const char *event; | 98 | const char *event; |
@@ -480,6 +487,16 @@ static void show_options(void) | |||
480 | fclose(fp); | 487 | fclose(fp); |
481 | } | 488 | } |
482 | 489 | ||
490 | static void save_option(const char *option) | ||
491 | { | ||
492 | struct opt_list *opt; | ||
493 | |||
494 | opt = malloc_or_die(sizeof(*opt)); | ||
495 | opt->next = options; | ||
496 | options = opt; | ||
497 | opt->option = option; | ||
498 | } | ||
499 | |||
483 | static void set_option(const char *option) | 500 | static void set_option(const char *option) |
484 | { | 501 | { |
485 | FILE *fp; | 502 | FILE *fp; |
@@ -495,6 +512,18 @@ static void set_option(const char *option) | |||
495 | fclose(fp); | 512 | fclose(fp); |
496 | } | 513 | } |
497 | 514 | ||
515 | static void set_options(void) | ||
516 | { | ||
517 | struct opt_list *opt; | ||
518 | |||
519 | while (options) { | ||
520 | opt = options; | ||
521 | options = opt->next; | ||
522 | set_option(opt->option); | ||
523 | free(opt); | ||
524 | } | ||
525 | } | ||
526 | |||
498 | static void old_update_events(const char *name, char update) | 527 | static void old_update_events(const char *name, char update) |
499 | { | 528 | { |
500 | char *path; | 529 | char *path; |
@@ -1427,7 +1456,7 @@ int main (int argc, char **argv) | |||
1427 | break; | 1456 | break; |
1428 | case 'O': | 1457 | case 'O': |
1429 | option = optarg; | 1458 | option = optarg; |
1430 | set_option(option); | 1459 | save_option(option); |
1431 | break; | 1460 | break; |
1432 | case 's': | 1461 | case 's': |
1433 | if (extract) | 1462 | if (extract) |
@@ -1566,6 +1595,8 @@ int main (int argc, char **argv) | |||
1566 | set_plugin(plugin); | 1595 | set_plugin(plugin); |
1567 | } | 1596 | } |
1568 | 1597 | ||
1598 | set_options(); | ||
1599 | |||
1569 | if (record || extract) { | 1600 | if (record || extract) { |
1570 | if (!latency) | 1601 | if (!latency) |
1571 | start_threads(); | 1602 | start_threads(); |