diff options
author | Paul Wise <pabs3@bonedaddy.net> | 2017-05-04 14:12:21 +0800 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2017-05-05 22:37:28 +0200 |
commit | 3c02699dd79a574f00adc06513516039f6996d90 (patch) | |
tree | d6729752c0bd8d7b0fa303f0e3f09a5da71cc9c7 | |
parent | 730fc6c7d87647eaf0d89dc1b75642d350f04a34 (diff) |
intelmetool: Print strerror() results for mmap errors
These are more human readable for folks not familiar with errno values.
Change-Id: I21352a00b583163472ccd3302a83adf1f8396c61
Signed-off-by: Paul Wise <pabs3@bonedaddy.net>
Reviewed-on: https://review.coreboot.org/19560
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
-rw-r--r-- | util/intelmetool/mmap.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/util/intelmetool/mmap.c b/util/intelmetool/mmap.c index 041aac9c81..2462b22dac 100644 --- a/util/intelmetool/mmap.c +++ b/util/intelmetool/mmap.c @@ -15,6 +15,7 @@ #include "mmap.h" #include <errno.h> +#include <string.h> #ifndef __DARWIN__ int fd_mem; @@ -28,8 +29,8 @@ void *map_physical_exact(off_t phys_addr, void *mapto, size_t len) { if (virt_addr == MAP_FAILED) { err = errno; - printf("Error mapping physical memory 0x%016jd [0x%zx] ERRNO=%d\n", - (intmax_t)phys_addr, len, err); + printf("Error mapping physical memory 0x%016jd [0x%zx] ERRNO=%d %s\n", + (intmax_t)phys_addr, len, err, strerror(err)); return NULL; } @@ -44,8 +45,8 @@ void *map_physical(off_t phys_addr, size_t len) { if (virt_addr == MAP_FAILED) { err = errno; - printf("Error mapping physical memory 0x%016jd [0x%zx] ERRNO=%d\n", - (intmax_t)phys_addr, len, err); + printf("Error mapping physical memory 0x%016jd [0x%zx] ERRNO=%d %s\n", + (intmax_t)phys_addr, len, err, strerror(err)); return NULL; } |