From 9398c484f8abc8d287cb90f5a33dd43ac26f24ef Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Mon, 11 Aug 2014 10:50:02 +0200 Subject: perf tools: Introduce set_term_quiet_input helper function Adding set_term_quiet_input helper to set the terminal quiet, out from 'perf top', used in following patches in 'perf kvm'. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Corey Ashford Cc: David Ahern Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Jean Pihet Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1407747014-18394-9-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/util.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tools/perf/util/util.c') diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index b82a93cb1694..25822bdf7bbf 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c @@ -13,6 +13,7 @@ #include #include #include +#include /* * XXX We need to find a better place for these things... @@ -282,6 +283,18 @@ void get_term_dimensions(struct winsize *ws) ws->ws_col = 80; } +void set_term_quiet_input(struct termios *old) +{ + struct termios tc; + + tcgetattr(0, old); + tc = *old; + tc.c_lflag &= ~(ICANON | ECHO); + tc.c_cc[VMIN] = 0; + tc.c_cc[VTIME] = 0; + tcsetattr(0, TCSANOW, &tc); +} + static void set_tracing_events_path(const char *mountpoint) { snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s", -- cgit v1.2.3-59-g8ed1b