[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1269274229-20442-1-git-send-email-acme@infradead.org>
Date: Mon, 22 Mar 2010 13:10:25 -0300
From: Arnaldo Carvalho de Melo <acme@...radead.org>
To: Ingo Molnar <mingo@...e.hu>
Cc: linux-kernel@...r.kernel.org,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Frédéric Weisbecker <fweisbec@...il.com>,
Mike Galbraith <efault@....de>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>
Subject: [PATCH 1/5] perf newt: Properly restore the screen when error exiting
From: Arnaldo Carvalho de Melo <acme@...hat.com>
Show an OK message box with the last message sent via pr_err, etc.
Reported-by: Ingo Molnar <mingo@...e.hu>
Cc: Frédéric Weisbecker <fweisbec@...il.com>
Cc: Mike Galbraith <efault@....de>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Paul Mackerras <paulus@...ba.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/perf.c | 4 ++--
tools/perf/util/cache.h | 4 ++--
tools/perf/util/newt.c | 19 +++++++++++++------
3 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index d2de839..2826e70 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -264,11 +264,11 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
set_debugfs_path();
status = p->fn(argc, argv, prefix);
+ exit_browser(status);
+
if (status)
return status & 0xff;
- exit_browser();
-
/* Somebody closed stdout? */
if (fstat(fileno(stdout), &st))
return 0;
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index 47b12a3..4b9aab7 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -77,10 +77,10 @@ static inline void setup_browser(void)
{
setup_pager();
}
-static inline void exit_browser(void) {}
+static inline void exit_browser(bool wait_for_ok __used) {}
#else
void setup_browser(void);
-void exit_browser(void);
+void exit_browser(bool wait_for_ok);
#endif
extern const char *editor_program;
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 2d19e7a..3c2ef95 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -170,18 +170,20 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
newtFormDestroy(form);
}
+static char browser__last_msg[1024];
+
int browser__show_help(const char *format, va_list ap)
{
int ret;
static int backlog;
- static char msg[1024];
- ret = vsnprintf(msg + backlog, sizeof(msg) - backlog, format, ap);
+ ret = vsnprintf(browser__last_msg + backlog,
+ sizeof(browser__last_msg) - backlog, format, ap);
backlog += ret;
- if (msg[backlog - 1] == '\n') {
+ if (browser__last_msg[backlog - 1] == '\n') {
newtPopHelpLine();
- newtPushHelpLine(msg);
+ newtPushHelpLine(browser__last_msg);
newtRefresh();
backlog = 0;
}
@@ -200,8 +202,13 @@ void setup_browser(void)
newtPushHelpLine(" ");
}
-void exit_browser(void)
+void exit_browser(bool wait_for_ok)
{
- if (use_browser)
+ if (use_browser) {
+ if (wait_for_ok) {
+ char title[] = "Fatal Error", ok[] = "Ok";
+ newtWinMessage(title, ok, browser__last_msg);
+ }
newtFinished();
+ }
}
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists