Commit 7b919a53 authored by Tommi Rantala's avatar Tommi Rantala Committed by Arnaldo Carvalho de Melo

perf bench: Clear struct sigaction before sigaction() syscall

Avoid garbage in sigaction structs used in sigaction() syscalls.
Valgrind is complaining about it.
Signed-off-by: default avatarTommi Rantala <tommi.t.rantala@nokia.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Changbin Du <changbin.du@intel.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lore.kernel.org/lkml/20200305083714.9381-4-tommi.t.rantala@nokia.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent f649bd9d
...@@ -312,6 +312,7 @@ int bench_epoll_ctl(int argc, const char **argv) ...@@ -312,6 +312,7 @@ int bench_epoll_ctl(int argc, const char **argv)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
memset(&act, 0, sizeof(act));
sigfillset(&act.sa_mask); sigfillset(&act.sa_mask);
act.sa_sigaction = toggle_done; act.sa_sigaction = toggle_done;
sigaction(SIGINT, &act, NULL); sigaction(SIGINT, &act, NULL);
......
...@@ -426,6 +426,7 @@ int bench_epoll_wait(int argc, const char **argv) ...@@ -426,6 +426,7 @@ int bench_epoll_wait(int argc, const char **argv)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
memset(&act, 0, sizeof(act));
sigfillset(&act.sa_mask); sigfillset(&act.sa_mask);
act.sa_sigaction = toggle_done; act.sa_sigaction = toggle_done;
sigaction(SIGINT, &act, NULL); sigaction(SIGINT, &act, NULL);
......
...@@ -137,6 +137,7 @@ int bench_futex_hash(int argc, const char **argv) ...@@ -137,6 +137,7 @@ int bench_futex_hash(int argc, const char **argv)
if (!cpu) if (!cpu)
goto errmem; goto errmem;
memset(&act, 0, sizeof(act));
sigfillset(&act.sa_mask); sigfillset(&act.sa_mask);
act.sa_sigaction = toggle_done; act.sa_sigaction = toggle_done;
sigaction(SIGINT, &act, NULL); sigaction(SIGINT, &act, NULL);
......
...@@ -160,6 +160,7 @@ int bench_futex_lock_pi(int argc, const char **argv) ...@@ -160,6 +160,7 @@ int bench_futex_lock_pi(int argc, const char **argv)
if (!cpu) if (!cpu)
err(EXIT_FAILURE, "calloc"); err(EXIT_FAILURE, "calloc");
memset(&act, 0, sizeof(act));
sigfillset(&act.sa_mask); sigfillset(&act.sa_mask);
act.sa_sigaction = toggle_done; act.sa_sigaction = toggle_done;
sigaction(SIGINT, &act, NULL); sigaction(SIGINT, &act, NULL);
......
...@@ -128,6 +128,7 @@ int bench_futex_requeue(int argc, const char **argv) ...@@ -128,6 +128,7 @@ int bench_futex_requeue(int argc, const char **argv)
if (!cpu) if (!cpu)
err(EXIT_FAILURE, "cpu_map__new"); err(EXIT_FAILURE, "cpu_map__new");
memset(&act, 0, sizeof(act));
sigfillset(&act.sa_mask); sigfillset(&act.sa_mask);
act.sa_sigaction = toggle_done; act.sa_sigaction = toggle_done;
sigaction(SIGINT, &act, NULL); sigaction(SIGINT, &act, NULL);
......
...@@ -234,6 +234,7 @@ int bench_futex_wake_parallel(int argc, const char **argv) ...@@ -234,6 +234,7 @@ int bench_futex_wake_parallel(int argc, const char **argv)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
memset(&act, 0, sizeof(act));
sigfillset(&act.sa_mask); sigfillset(&act.sa_mask);
act.sa_sigaction = toggle_done; act.sa_sigaction = toggle_done;
sigaction(SIGINT, &act, NULL); sigaction(SIGINT, &act, NULL);
......
...@@ -136,6 +136,7 @@ int bench_futex_wake(int argc, const char **argv) ...@@ -136,6 +136,7 @@ int bench_futex_wake(int argc, const char **argv)
if (!cpu) if (!cpu)
err(EXIT_FAILURE, "calloc"); err(EXIT_FAILURE, "calloc");
memset(&act, 0, sizeof(act));
sigfillset(&act.sa_mask); sigfillset(&act.sa_mask);
act.sa_sigaction = toggle_done; act.sa_sigaction = toggle_done;
sigaction(SIGINT, &act, NULL); sigaction(SIGINT, &act, NULL);
......
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