< prev index next >
src/hotspot/os/posix/os_posix.cpp
Print this page
@@ -241,12 +241,13 @@
// Map the given address range to the provided file descriptor.
char* os::map_memory_to_file(char* base, size_t size, int fd) {
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. (%s)", os::strerror(ret)));
return NULL;
}
int prot = PROT_READ | PROT_WRITE;
int flags = MAP_SHARED;
@@ -254,10 +255,11 @@
flags |= MAP_FIXED;
}
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");
< prev index next >