< prev index next >

src/hotspot/os/posix/os_posix.cpp

Print this page

        

*** 51,60 **** --- 51,64 ---- #ifndef MAX_PID #define MAX_PID INT_MAX #endif #define IS_VALID_PID(p) (p > 0 && p < MAX_PID) + #ifndef MAP_ANONYMOUS + #define MAP_ANONYMOUS MAP_ANON + #endif + #define check_with_errno(check_type, cond, msg) \ do { \ int err = errno; \ check_type(cond, "%s; error='%s' (errno=%s)", msg, os::strerror(err), \ os::errno_name(err)); \
*** 172,208 **** sigset_t set, oldset; int ret = sigfillset(&set); assert_with_errno(ret == 0, "sigfillset returned error"); - // block all signals while we do the file operation. - ret = pthread_sigmask(SIG_BLOCK, &set, &oldset); - assert_with_errno(ret == 0, "pthread_sigmask returned error"); - // set the file creation mask. mode_t file_mode = S_IRUSR | S_IWUSR; // create a new file. int fd = mkstemp(fullname); if (fd < 0) { ! // reset the signal mask. ! ret = pthread_sigmask(SIG_SETMASK, &oldset, NULL); ! assert_with_errno(ret == 0, "pthread_sigmask returned error"); ! warning("Could not create file for heap"); os::free(fullname); return -1; } // delete the name from the filesystem. When 'fd' is closed, the file (and space) will be deleted. ret = unlink(fullname); assert_with_errno(ret == 0, "unlink returned error"); - // reset the signal mask. - ret = pthread_sigmask(SIG_SETMASK, &oldset, NULL); - assert_with_errno(ret == 0, "pthread_sigmask returned error"); - os::free(fullname); return fd; } static char* reserve_mmapped_memory(size_t bytes, char* requested_addr) { --- 176,201 ---- sigset_t set, oldset; int ret = sigfillset(&set); assert_with_errno(ret == 0, "sigfillset returned error"); // set the file creation mask. mode_t file_mode = S_IRUSR | S_IWUSR; // create a new file. int fd = mkstemp(fullname); if (fd < 0) { ! warning("Could not create file for heap with template %s", fullname); os::free(fullname); return -1; } // delete the name from the filesystem. When 'fd' is closed, the file (and space) will be deleted. ret = unlink(fullname); assert_with_errno(ret == 0, "unlink returned error"); os::free(fullname); return fd; } static char* reserve_mmapped_memory(size_t bytes, char* requested_addr) {
*** 279,313 **** assert(base != NULL, "Base cannot be NULL"); return map_memory_to_dax_file(base, size, fd); } - char* os::attempt_reserve_memory_at(size_t bytes, char* addr, int file_desc) { - - // We would want to use the complex logic in pd_attempt_reserve_memory_at(), especially in Linux. - // So we call pd_attempt_reserve_memory_at() to purely reserve memory - // and then replace the anonymous mapping with file mapping. - // Unfortunately for AIX, we need to pass new bool parameter to pd_attempt_reserve_memory_at() - // to indicate not to use SHM - #if defined(AIX) - char* result = pd_attempt_reserve_memory_at(bytes, addr, file_desc == -1 /*use_SHM*/); - #else - char* result = pd_attempt_reserve_memory_at(bytes, addr); - #endif - if (result != NULL) { - if (file_desc != -1) { - if (replace_existing_mapping_with_dax_file_mapping(result, bytes, file_desc) == NULL) { - vm_exit_during_initialization(err_msg("Error in mapping Java heap at the given filesystem directory")); - } - MemTracker::record_virtual_memory_reserve_and_commit((address)result, bytes, CALLER_PC); - } else { - MemTracker::record_virtual_memory_reserve((address)result, bytes, CALLER_PC); - } - } - return result; - } - // Multiple threads can race in this code, and can remap over each other with MAP_FIXED, // so on posix, unmap the section at the start and at the end of the chunk that we mapped // rather than unmapping and remapping the whole chunk to get requested alignment. char* os::reserve_memory_aligned(size_t size, size_t alignment, int file_desc) { assert((alignment & (os::vm_allocation_granularity() - 1)) == 0, --- 272,281 ----
< prev index next >