Commit ca09b2e1 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

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: default avatarNamhyung Kim <namhyung.kim@lge.com>
Acked-by: default avatarPekka 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 12864b31
...@@ -93,14 +93,37 @@ static void newt_suspend(void *d __used) ...@@ -93,14 +93,37 @@ static void newt_suspend(void *d __used)
newtResume(); newtResume();
} }
static void ui__exit(void);
static void ui__signal(int sig)
{
ui__exit();
psignal(sig, "perf");
exit(0);
}
static int ui__init(void) static int ui__init(void)
{ {
int err = SLkp_init(); int err;
if (err < 0) newtInit();
err = SLkp_init();
if (err < 0) {
pr_err("TUI initialization failed.\n");
goto out; goto out;
}
SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB); SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB);
newtSetSuspendCallback(newt_suspend, NULL);
ui_helpline__init();
ui_browser__init();
signal(SIGSEGV, ui__signal);
signal(SIGFPE, ui__signal);
signal(SIGINT, ui__signal);
signal(SIGQUIT, ui__signal);
signal(SIGTERM, ui__signal);
out: out:
return err; return err;
} }
...@@ -113,13 +136,6 @@ static void ui__exit(void) ...@@ -113,13 +136,6 @@ static void ui__exit(void)
SLang_reset_tty(); SLang_reset_tty();
} }
static void ui__signal(int sig)
{
ui__exit();
psignal(sig, "perf");
exit(0);
}
void setup_browser(bool fallback_to_pager) void setup_browser(bool fallback_to_pager)
{ {
if (!isatty(1) || !use_browser || dump_trace) { if (!isatty(1) || !use_browser || dump_trace) {
...@@ -130,17 +146,7 @@ void setup_browser(bool fallback_to_pager) ...@@ -130,17 +146,7 @@ void setup_browser(bool fallback_to_pager)
} }
use_browser = 1; use_browser = 1;
newtInit();
ui__init(); ui__init();
newtSetSuspendCallback(newt_suspend, NULL);
ui_helpline__init();
ui_browser__init();
signal(SIGSEGV, ui__signal);
signal(SIGFPE, ui__signal);
signal(SIGINT, ui__signal);
signal(SIGQUIT, ui__signal);
signal(SIGTERM, ui__signal);
} }
void exit_browser(bool wait_for_ok) void exit_browser(bool wait_for_ok)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment