Skip to content

Commit be3f584

Browse files
committed
Make error messages in utils_mmap_file() more verbose
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 9e65d4b commit be3f584

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/utils/utils_linux_common.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ void *utils_mmap_file(void *hint_addr, size_t length, int prot, int flags,
5656
if (flags & MAP_PRIVATE) {
5757
addr = utils_mmap(hint_addr, length, prot, flags, fd, fd_offset);
5858
if (addr == MAP_FAILED) {
59-
LOG_PERR("mapping file with the MAP_PRIVATE flag failed");
59+
LOG_PERR("mapping file with the MAP_PRIVATE flag failed (fd=%i, "
60+
"offset=%zu, length=%zu)",
61+
fd, fd_offset, length);
6062
return NULL;
6163
}
6264

@@ -81,7 +83,9 @@ void *utils_mmap_file(void *hint_addr, size_t length, int prot, int flags,
8183
return addr;
8284
}
8385

84-
LOG_PERR("mapping file with the MAP_SYNC flag failed");
86+
LOG_PERR("mapping file with the MAP_SYNC flag failed (fd=%i, "
87+
"offset=%zu, length=%zu)",
88+
fd, fd_offset, length);
8589
}
8690

8791
if ((!(flags & MAP_SYNC)) || errno == EINVAL || errno == ENOTSUP ||
@@ -96,7 +100,9 @@ void *utils_mmap_file(void *hint_addr, size_t length, int prot, int flags,
96100
return addr;
97101
}
98102

99-
LOG_PERR("mapping file with the MAP_SHARED flag failed");
103+
LOG_PERR("mapping file with the MAP_SHARED flag failed (fd=%i, "
104+
"offset=%zu, length=%zu)",
105+
fd, fd_offset, length);
100106
}
101107

102108
return NULL;

0 commit comments

Comments
 (0)