diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2014-08-13 22:22:45 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-08-15 12:07:28 -0400 |
commit | ba3dfff8ad2d98df0c8116faaeb281c93e161636 (patch) | |
tree | 2fa417b3aebbe73297242806eedb7a28633cb87b /tools/perf/tests/mmap-basic.c | |
parent | 35550da389ba8752f024a44ef14b74001c4fc4d3 (diff) |
perf test: Use strerror_r instead of strerror
Use strerror_r instead of strerror in error messages for thread-safety.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naohiro Aota <naota@elisp.net>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20140814022245.3545.91394.stgit@kbuild-fedora.novalocal
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/mmap-basic.c')
-rw-r--r-- | tools/perf/tests/mmap-basic.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index 142263492f6f..9b9622a33932 100644 --- a/tools/perf/tests/mmap-basic.c +++ b/tools/perf/tests/mmap-basic.c | |||
@@ -31,6 +31,7 @@ int test__basic_mmap(void) | |||
31 | unsigned int nr_events[nsyscalls], | 31 | unsigned int nr_events[nsyscalls], |
32 | expected_nr_events[nsyscalls], i, j; | 32 | expected_nr_events[nsyscalls], i, j; |
33 | struct perf_evsel *evsels[nsyscalls], *evsel; | 33 | struct perf_evsel *evsels[nsyscalls], *evsel; |
34 | char sbuf[STRERR_BUFSIZE]; | ||
34 | 35 | ||
35 | threads = thread_map__new(-1, getpid(), UINT_MAX); | 36 | threads = thread_map__new(-1, getpid(), UINT_MAX); |
36 | if (threads == NULL) { | 37 | if (threads == NULL) { |
@@ -49,7 +50,7 @@ int test__basic_mmap(void) | |||
49 | sched_setaffinity(0, sizeof(cpu_set), &cpu_set); | 50 | sched_setaffinity(0, sizeof(cpu_set), &cpu_set); |
50 | if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set) < 0) { | 51 | if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set) < 0) { |
51 | pr_debug("sched_setaffinity() failed on CPU %d: %s ", | 52 | pr_debug("sched_setaffinity() failed on CPU %d: %s ", |
52 | cpus->map[0], strerror(errno)); | 53 | cpus->map[0], strerror_r(errno, sbuf, sizeof(sbuf))); |
53 | goto out_free_cpus; | 54 | goto out_free_cpus; |
54 | } | 55 | } |
55 | 56 | ||
@@ -79,7 +80,7 @@ int test__basic_mmap(void) | |||
79 | if (perf_evsel__open(evsels[i], cpus, threads) < 0) { | 80 | if (perf_evsel__open(evsels[i], cpus, threads) < 0) { |
80 | pr_debug("failed to open counter: %s, " | 81 | pr_debug("failed to open counter: %s, " |
81 | "tweak /proc/sys/kernel/perf_event_paranoid?\n", | 82 | "tweak /proc/sys/kernel/perf_event_paranoid?\n", |
82 | strerror(errno)); | 83 | strerror_r(errno, sbuf, sizeof(sbuf))); |
83 | goto out_delete_evlist; | 84 | goto out_delete_evlist; |
84 | } | 85 | } |
85 | 86 | ||
@@ -89,7 +90,7 @@ int test__basic_mmap(void) | |||
89 | 90 | ||
90 | if (perf_evlist__mmap(evlist, 128, true) < 0) { | 91 | if (perf_evlist__mmap(evlist, 128, true) < 0) { |
91 | pr_debug("failed to mmap events: %d (%s)\n", errno, | 92 | pr_debug("failed to mmap events: %d (%s)\n", errno, |
92 | strerror(errno)); | 93 | strerror_r(errno, sbuf, sizeof(sbuf))); |
93 | goto out_delete_evlist; | 94 | goto out_delete_evlist; |
94 | } | 95 | } |
95 | 96 | ||