diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-03-23 16:42:21 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-03-23 16:42:21 -0400 |
commit | 76267147f233f347dbd8f4f8c05492e5ea0a7dce (patch) | |
tree | 7886f29147adb660f578c4a9d7d1cd66a8218f1b /tools | |
parent | 78478269d2c9be315164d15c14e6e222a06d2f40 (diff) |
perf llvm: Use strerror_r instead of the thread unsafe strerror one
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-5njrq9dltckgm624omw9ljgu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/llvm-utils.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/perf/util/llvm-utils.c b/tools/perf/util/llvm-utils.c index aab855f491ca..33071d6159bc 100644 --- a/tools/perf/util/llvm-utils.c +++ b/tools/perf/util/llvm-utils.c | |||
@@ -98,11 +98,12 @@ read_from_pipe(const char *cmd, void **p_buf, size_t *p_read_sz) | |||
98 | void *buf = NULL; | 98 | void *buf = NULL; |
99 | FILE *file = NULL; | 99 | FILE *file = NULL; |
100 | size_t read_sz = 0, buf_sz = 0; | 100 | size_t read_sz = 0, buf_sz = 0; |
101 | char serr[STRERR_BUFSIZE]; | ||
101 | 102 | ||
102 | file = popen(cmd, "r"); | 103 | file = popen(cmd, "r"); |
103 | if (!file) { | 104 | if (!file) { |
104 | pr_err("ERROR: unable to popen cmd: %s\n", | 105 | pr_err("ERROR: unable to popen cmd: %s\n", |
105 | strerror(errno)); | 106 | strerror_r(errno, serr, sizeof(serr))); |
106 | return -EINVAL; | 107 | return -EINVAL; |
107 | } | 108 | } |
108 | 109 | ||
@@ -136,7 +137,7 @@ read_from_pipe(const char *cmd, void **p_buf, size_t *p_read_sz) | |||
136 | 137 | ||
137 | if (ferror(file)) { | 138 | if (ferror(file)) { |
138 | pr_err("ERROR: error occurred when reading from pipe: %s\n", | 139 | pr_err("ERROR: error occurred when reading from pipe: %s\n", |
139 | strerror(errno)); | 140 | strerror_r(errno, serr, sizeof(serr))); |
140 | err = -EIO; | 141 | err = -EIO; |
141 | goto errout; | 142 | goto errout; |
142 | } | 143 | } |
@@ -370,7 +371,7 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf, | |||
370 | if (nr_cpus_avail <= 0) { | 371 | if (nr_cpus_avail <= 0) { |
371 | pr_err( | 372 | pr_err( |
372 | "WARNING:\tunable to get available CPUs in this system: %s\n" | 373 | "WARNING:\tunable to get available CPUs in this system: %s\n" |
373 | " \tUse 128 instead.\n", strerror(errno)); | 374 | " \tUse 128 instead.\n", strerror_r(errno, serr, sizeof(serr))); |
374 | nr_cpus_avail = 128; | 375 | nr_cpus_avail = 128; |
375 | } | 376 | } |
376 | snprintf(nr_cpus_avail_str, sizeof(nr_cpus_avail_str), "%d", | 377 | snprintf(nr_cpus_avail_str, sizeof(nr_cpus_avail_str), "%d", |