changeset 48317:8bb6cdfa44eb

8193105: Print error code when map_memory_to_file() fails Reviewed-by: dholmes, kbarrett
author sangheki
date Thu, 07 Dec 2017 10:21:13 -0800
parents 4d28288c9f9e
children ff1172e2c56a
files src/hotspot/os/posix/os_posix.cpp
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/os/posix/os_posix.cpp	Thu Dec 07 15:52:46 2017 +0100
+++ b/src/hotspot/os/posix/os_posix.cpp	Thu Dec 07 10:21:13 2017 -0800
@@ -243,8 +243,9 @@
   assert(fd != -1, "File descriptor is not valid");
 
   // allocate space for the file
-  if (util_posix_fallocate(fd, 0, (off_t)size) != 0) {
-    vm_exit_during_initialization(err_msg("Error in mapping Java heap at the given filesystem directory."));
+  int ret = util_posix_fallocate(fd, 0, (off_t)size);
+  if (ret != 0) {
+    vm_exit_during_initialization(err_msg("Error in mapping Java heap at the given filesystem directory. error(%d)", ret));
     return NULL;
   }
 
@@ -256,12 +257,13 @@
   char* addr = (char*)mmap(base, size, prot, flags, fd, 0);
 
   if (addr == MAP_FAILED) {
+    warning("Failed mmap to file. (%s)", os::strerror(errno));
     return NULL;
   }
   if (base != NULL && addr != base) {
     if (!os::release_memory(addr, size)) {
       warning("Could not release memory on unsuccessful file mapping");
-     }
+    }
     return NULL;
   }
   return addr;