mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 19:44:41 +02:00
8193105: Print error code when map_memory_to_file() fails
Reviewed-by: dholmes, kbarrett
This commit is contained in:
parent
29bab311ab
commit
0ce6f0b889
1 changed files with 5 additions and 3 deletions
|
@ -243,8 +243,9 @@ char* os::map_memory_to_file(char* base, size_t size, int fd) {
|
||||||
assert(fd != -1, "File descriptor is not valid");
|
assert(fd != -1, "File descriptor is not valid");
|
||||||
|
|
||||||
// allocate space for the file
|
// allocate space for the file
|
||||||
if (util_posix_fallocate(fd, 0, (off_t)size) != 0) {
|
int ret = util_posix_fallocate(fd, 0, (off_t)size);
|
||||||
vm_exit_during_initialization(err_msg("Error in mapping Java heap at the given filesystem directory."));
|
if (ret != 0) {
|
||||||
|
vm_exit_during_initialization(err_msg("Error in mapping Java heap at the given filesystem directory. error(%d)", ret));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,6 +257,7 @@ char* os::map_memory_to_file(char* base, size_t size, int fd) {
|
||||||
char* addr = (char*)mmap(base, size, prot, flags, fd, 0);
|
char* addr = (char*)mmap(base, size, prot, flags, fd, 0);
|
||||||
|
|
||||||
if (addr == MAP_FAILED) {
|
if (addr == MAP_FAILED) {
|
||||||
|
warning("Failed mmap to file. (%s)", os::strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (base != NULL && addr != base) {
|
if (base != NULL && addr != base) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue