From 3c02699dd79a574f00adc06513516039f6996d90 Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Thu, 4 May 2017 14:12:21 +0800 Subject: 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 Reviewed-on: https://review.coreboot.org/19560 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Philipp Deppenwiese --- util/intelmetool/mmap.c | 9 +++++---- 1 file 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 +#include #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; } -- cgit v1.2.3