diff options
author | Jiri Olsa <jolsa@kernel.org> | 2017-11-15 08:30:57 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-11-28 12:27:43 -0500 |
commit | bdaab8c4b3db820b0946ed4516bc5ec811e0cc82 (patch) | |
tree | cf4f452a9495eab6944148aa54a3099e826cbf2d /tools/perf | |
parent | 89d0aeab4252adc2a7ea693637dd21c588bfa2d1 (diff) |
perf top: Use signal interface for SIGWINCH handler
There's no need for SA_SIGINFO data in SIGWINCH handler, switching it to
register the handler via signal interface as we do for the rest of the
signals in perf top.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-elxp1vdnaog1scaj13cx7cu0@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-top.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 489573883936..9e0d2645ae13 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -86,8 +86,7 @@ static void perf_top__update_print_entries(struct perf_top *top) | |||
86 | top->print_entries = top->winsize.ws_row - HEADER_LINE_NR; | 86 | top->print_entries = top->winsize.ws_row - HEADER_LINE_NR; |
87 | } | 87 | } |
88 | 88 | ||
89 | static void perf_top__sig_winch(int sig __maybe_unused, | 89 | static void winch_sig(int sig __maybe_unused) |
90 | siginfo_t *info __maybe_unused, void *arg __maybe_unused) | ||
91 | { | 90 | { |
92 | resize = 1; | 91 | resize = 1; |
93 | } | 92 | } |
@@ -477,12 +476,8 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c) | |||
477 | case 'e': | 476 | case 'e': |
478 | prompt_integer(&top->print_entries, "Enter display entries (lines)"); | 477 | prompt_integer(&top->print_entries, "Enter display entries (lines)"); |
479 | if (top->print_entries == 0) { | 478 | if (top->print_entries == 0) { |
480 | struct sigaction act = { | ||
481 | .sa_sigaction = perf_top__sig_winch, | ||
482 | .sa_flags = SA_SIGINFO, | ||
483 | }; | ||
484 | perf_top__resize(top); | 479 | perf_top__resize(top); |
485 | sigaction(SIGWINCH, &act, NULL); | 480 | signal(SIGWINCH, winch_sig); |
486 | } else { | 481 | } else { |
487 | signal(SIGWINCH, SIG_DFL); | 482 | signal(SIGWINCH, SIG_DFL); |
488 | } | 483 | } |
@@ -1363,12 +1358,8 @@ int cmd_top(int argc, const char **argv) | |||
1363 | 1358 | ||
1364 | get_term_dimensions(&top.winsize); | 1359 | get_term_dimensions(&top.winsize); |
1365 | if (top.print_entries == 0) { | 1360 | if (top.print_entries == 0) { |
1366 | struct sigaction act = { | ||
1367 | .sa_sigaction = perf_top__sig_winch, | ||
1368 | .sa_flags = SA_SIGINFO, | ||
1369 | }; | ||
1370 | perf_top__update_print_entries(&top); | 1361 | perf_top__update_print_entries(&top); |
1371 | sigaction(SIGWINCH, &act, NULL); | 1362 | signal(SIGWINCH, winch_sig); |
1372 | } | 1363 | } |
1373 | 1364 | ||
1374 | status = __cmd_top(&top); | 1365 | status = __cmd_top(&top); |