Skip to contentSkip to conversation

perf top: Use set_term_quiet() instead of open coded equivalent

tip:perf/core tip-bot for Jiri Olsa 1 participant 1 message Aug 24, 2014 perf events

lore
Share & tools
lore

tip-bot for Jiri Olsa

author merge bot
#0 lore raw
Commit-ID:  3969cc094a9dbb40e624b259caa73c7a2056b249
Gitweb:     http://git.kernel.org/tip/3969cc094a9dbb40e624b259caa73c7a2056b249
Author:     Jiri Olsa <[email protected]>
AuthorDate: Fri, 15 Aug 2014 16:24:45 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Sun, 24 Aug 2014 08:11:18 -0300

perf top: Use set_term_quiet() instead of open coded equivalent

Cc Adrian Hunter <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jean Pihet <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
[ Yanked this out of a patch containing this and some other change ]
---
 tools/perf/builtin-top.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
tools/perf/builtin-top.c +2 -7
index a77ff6c..9848e27 100644
@@ -433,18 +433,13 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
 
 	if (!perf_top__key_mapped(top, c)) {
 		struct pollfd stdin_poll = { .fd = 0, .events = POLLIN };
-		struct termios tc, save;
+		struct termios save;
 
 		perf_top__print_mapped_keys(top);
 		fprintf(stdout, "\nEnter selection, or unmapped key to continue: ");
 		fflush(stdout);
 
-		tcgetattr(0, &save);
-		tc = save;
-		tc.c_lflag &= ~(ICANON | ECHO);
-		tc.c_cc[VMIN] = 0;
-		tc.c_cc[VTIME] = 0;
-		tcsetattr(0, TCSANOW, &tc);
+		set_term_quiet_input(&save);
 
 		poll(&stdin_poll, 1, -1);
 		c = getc(stdin);