aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/dso.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/dso.c')
-rw-r--r--tools/perf/util/dso.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index bdafd306fb52..55e39dc1bcda 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -162,13 +162,15 @@ static void close_first_dso(void);
162static int do_open(char *name) 162static int do_open(char *name)
163{ 163{
164 int fd; 164 int fd;
165 char sbuf[STRERR_BUFSIZE];
165 166
166 do { 167 do {
167 fd = open(name, O_RDONLY); 168 fd = open(name, O_RDONLY);
168 if (fd >= 0) 169 if (fd >= 0)
169 return fd; 170 return fd;
170 171
171 pr_debug("dso open failed, mmap: %s\n", strerror(errno)); 172 pr_debug("dso open failed, mmap: %s\n",
173 strerror_r(errno, sbuf, sizeof(sbuf)));
172 if (!dso__data_open_cnt || errno != EMFILE) 174 if (!dso__data_open_cnt || errno != EMFILE)
173 break; 175 break;
174 176
@@ -530,10 +532,12 @@ static ssize_t cached_read(struct dso *dso, u64 offset, u8 *data, ssize_t size)
530static int data_file_size(struct dso *dso) 532static int data_file_size(struct dso *dso)
531{ 533{
532 struct stat st; 534 struct stat st;
535 char sbuf[STRERR_BUFSIZE];
533 536
534 if (!dso->data.file_size) { 537 if (!dso->data.file_size) {
535 if (fstat(dso->data.fd, &st)) { 538 if (fstat(dso->data.fd, &st)) {
536 pr_err("dso mmap failed, fstat: %s\n", strerror(errno)); 539 pr_err("dso mmap failed, fstat: %s\n",
540 strerror_r(errno, sbuf, sizeof(sbuf)));
537 return -1; 541 return -1;
538 } 542 }
539 dso->data.file_size = st.st_size; 543 dso->data.file_size = st.st_size;