Commit bdaab8c4 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

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: default avatarJiri Olsa <jolsa@kernel.org>
Tested-by: default avatarRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Tested-by: default avatarArnaldo 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 89d0aeab
...@@ -86,8 +86,7 @@ static void perf_top__update_print_entries(struct perf_top *top) ...@@ -86,8 +86,7 @@ static void perf_top__update_print_entries(struct perf_top *top)
top->print_entries = top->winsize.ws_row - HEADER_LINE_NR; top->print_entries = top->winsize.ws_row - HEADER_LINE_NR;
} }
static void perf_top__sig_winch(int sig __maybe_unused, static void winch_sig(int sig __maybe_unused)
siginfo_t *info __maybe_unused, void *arg __maybe_unused)
{ {
resize = 1; resize = 1;
} }
...@@ -477,12 +476,8 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c) ...@@ -477,12 +476,8 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
case 'e': case 'e':
prompt_integer(&top->print_entries, "Enter display entries (lines)"); prompt_integer(&top->print_entries, "Enter display entries (lines)");
if (top->print_entries == 0) { if (top->print_entries == 0) {
struct sigaction act = {
.sa_sigaction = perf_top__sig_winch,
.sa_flags = SA_SIGINFO,
};
perf_top__resize(top); perf_top__resize(top);
sigaction(SIGWINCH, &act, NULL); signal(SIGWINCH, winch_sig);
} else { } else {
signal(SIGWINCH, SIG_DFL); signal(SIGWINCH, SIG_DFL);
} }
...@@ -1363,12 +1358,8 @@ int cmd_top(int argc, const char **argv) ...@@ -1363,12 +1358,8 @@ int cmd_top(int argc, const char **argv)
get_term_dimensions(&top.winsize); get_term_dimensions(&top.winsize);
if (top.print_entries == 0) { if (top.print_entries == 0) {
struct sigaction act = {
.sa_sigaction = perf_top__sig_winch,
.sa_flags = SA_SIGINFO,
};
perf_top__update_print_entries(&top); perf_top__update_print_entries(&top);
sigaction(SIGWINCH, &act, NULL); signal(SIGWINCH, winch_sig);
} }
status = __cmd_top(&top); status = __cmd_top(&top);
......
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