aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-04-30 00:55:05 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-05-02 15:17:20 -0400
commitca09b2e1b307724666577859eb460ac6d4c67330 (patch)
tree6516298b0c5926295143666a5c56fdc27199f438
parent12864b31583bcbd26789ebe68c612688f9ee2e30 (diff)
perf ui: Make setup_browser() generic
The setup_browser contained newt-related codes in it. As gtk front-end added recently, it should be more generic to handle both cases properly. So move newt codes to the ui__init() for now. Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Acked-by: Pekka Enberg <penberg@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Pekka Enberg <penberg@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1335761711-31403-2-git-send-email-namhyung.kim@lge.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/ui/setup.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index 85a69faa09aa..becdcd0d9ce7 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -93,14 +93,37 @@ static void newt_suspend(void *d __used)
93 newtResume(); 93 newtResume();
94} 94}
95 95
96static void ui__exit(void);
97
98static void ui__signal(int sig)
99{
100 ui__exit();
101 psignal(sig, "perf");
102 exit(0);
103}
104
96static int ui__init(void) 105static int ui__init(void)
97{ 106{
98 int err = SLkp_init(); 107 int err;
99 108
100 if (err < 0) 109 newtInit();
110 err = SLkp_init();
111 if (err < 0) {
112 pr_err("TUI initialization failed.\n");
101 goto out; 113 goto out;
114 }
102 115
103 SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB); 116 SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB);
117
118 newtSetSuspendCallback(newt_suspend, NULL);
119 ui_helpline__init();
120 ui_browser__init();
121
122 signal(SIGSEGV, ui__signal);
123 signal(SIGFPE, ui__signal);
124 signal(SIGINT, ui__signal);
125 signal(SIGQUIT, ui__signal);
126 signal(SIGTERM, ui__signal);
104out: 127out:
105 return err; 128 return err;
106} 129}
@@ -113,13 +136,6 @@ static void ui__exit(void)
113 SLang_reset_tty(); 136 SLang_reset_tty();
114} 137}
115 138
116static void ui__signal(int sig)
117{
118 ui__exit();
119 psignal(sig, "perf");
120 exit(0);
121}
122
123void setup_browser(bool fallback_to_pager) 139void setup_browser(bool fallback_to_pager)
124{ 140{
125 if (!isatty(1) || !use_browser || dump_trace) { 141 if (!isatty(1) || !use_browser || dump_trace) {
@@ -130,17 +146,7 @@ void setup_browser(bool fallback_to_pager)
130 } 146 }
131 147
132 use_browser = 1; 148 use_browser = 1;
133 newtInit();
134 ui__init(); 149 ui__init();
135 newtSetSuspendCallback(newt_suspend, NULL);
136 ui_helpline__init();
137 ui_browser__init();
138
139 signal(SIGSEGV, ui__signal);
140 signal(SIGFPE, ui__signal);
141 signal(SIGINT, ui__signal);
142 signal(SIGQUIT, ui__signal);
143 signal(SIGTERM, ui__signal);
144} 150}
145 151
146void exit_browser(bool wait_for_ok) 152void exit_browser(bool wait_for_ok)