< prev index next >

src/hotspot/os/posix/os_posix.cpp

Print this page

        

*** 241,252 **** // 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.")); return NULL; } int prot = PROT_READ | PROT_WRITE; int flags = MAP_SHARED; --- 241,253 ---- // 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 ! 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,263 **** --- 255,265 ---- 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 >