diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2014-08-13 22:22:51 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-08-15 12:08:14 -0400 |
commit | f9f33fdba159a9c163ecf1dc0106ebd4c2498130 (patch) | |
tree | 8c94a8f99c047b5cfb3eff84c15b2fb0e3cda91e | |
parent | 340481ada1af9322d99e9c1ba874391f53ff4fce (diff) |
perf kvm: 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/20140814022251.3545.83718.stgit@kbuild-fedora.novalocal
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-kvm.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 14d03edc81c2..1a4ef9cd9d5f 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c | |||
@@ -990,6 +990,7 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm) | |||
990 | int err, rc = -1; | 990 | int err, rc = -1; |
991 | struct perf_evsel *pos; | 991 | struct perf_evsel *pos; |
992 | struct perf_evlist *evlist = kvm->evlist; | 992 | struct perf_evlist *evlist = kvm->evlist; |
993 | char sbuf[STRERR_BUFSIZE]; | ||
993 | 994 | ||
994 | perf_evlist__config(evlist, &kvm->opts); | 995 | perf_evlist__config(evlist, &kvm->opts); |
995 | 996 | ||
@@ -1026,12 +1027,14 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm) | |||
1026 | 1027 | ||
1027 | err = perf_evlist__open(evlist); | 1028 | err = perf_evlist__open(evlist); |
1028 | if (err < 0) { | 1029 | if (err < 0) { |
1029 | printf("Couldn't create the events: %s\n", strerror(errno)); | 1030 | printf("Couldn't create the events: %s\n", |
1031 | strerror_r(errno, sbuf, sizeof(sbuf))); | ||
1030 | goto out; | 1032 | goto out; |
1031 | } | 1033 | } |
1032 | 1034 | ||
1033 | if (perf_evlist__mmap(evlist, kvm->opts.mmap_pages, false) < 0) { | 1035 | if (perf_evlist__mmap(evlist, kvm->opts.mmap_pages, false) < 0) { |
1034 | ui__error("Failed to mmap the events: %s\n", strerror(errno)); | 1036 | ui__error("Failed to mmap the events: %s\n", |
1037 | strerror_r(errno, sbuf, sizeof(sbuf))); | ||
1035 | perf_evlist__close(evlist); | 1038 | perf_evlist__close(evlist); |
1036 | goto out; | 1039 | goto out; |
1037 | } | 1040 | } |