Skip to content

Commit 244a108

Browse files
olsajiriacmel
authored andcommitted
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>
1 parent b135e5e commit 244a108

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

tools/perf/builtin-top.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ static void perf_top__update_print_entries(struct perf_top *top)
8686
top->print_entries = top->winsize.ws_row - HEADER_LINE_NR;
8787
}
8888

89-
static void perf_top__sig_winch(int sig __maybe_unused,
90-
siginfo_t *info __maybe_unused, void *arg __maybe_unused)
89+
static void winch_sig(int sig __maybe_unused)
9190
{
9291
resize = 1;
9392
}
@@ -480,12 +479,8 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
480479
case 'e':
481480
prompt_integer(&top->print_entries, "Enter display entries (lines)");
482481
if (top->print_entries == 0) {
483-
struct sigaction act = {
484-
.sa_sigaction = perf_top__sig_winch,
485-
.sa_flags = SA_SIGINFO,
486-
};
487482
perf_top__resize(top);
488-
sigaction(SIGWINCH, &act, NULL);
483+
signal(SIGWINCH, winch_sig);
489484
} else {
490485
signal(SIGWINCH, SIG_DFL);
491486
}
@@ -1366,12 +1361,8 @@ int cmd_top(int argc, const char **argv)
13661361

13671362
get_term_dimensions(&top.winsize);
13681363
if (top.print_entries == 0) {
1369-
struct sigaction act = {
1370-
.sa_sigaction = perf_top__sig_winch,
1371-
.sa_flags = SA_SIGINFO,
1372-
};
13731364
perf_top__update_print_entries(&top);
1374-
sigaction(SIGWINCH, &act, NULL);
1365+
signal(SIGWINCH, winch_sig);
13751366
}
13761367

13771368
status = __cmd_top(&top);

0 commit comments

Comments
 (0)