2678 assert(mesg != NULL, "mesg must be specified"); |
2678 assert(mesg != NULL, "mesg must be specified"); |
2679 int err = os::Linux::commit_memory_impl(addr, size, exec); |
2679 int err = os::Linux::commit_memory_impl(addr, size, exec); |
2680 if (err != 0) { |
2680 if (err != 0) { |
2681 // the caller wants all commit errors to exit with the specified mesg: |
2681 // the caller wants all commit errors to exit with the specified mesg: |
2682 warn_fail_commit_memory(addr, size, exec, err); |
2682 warn_fail_commit_memory(addr, size, exec, err); |
2683 vm_exit_out_of_memory(size, OOM_MMAP_ERROR, mesg); |
2683 vm_exit_out_of_memory(size, OOM_MMAP_ERROR, "%s", mesg); |
2684 } |
2684 } |
2685 } |
2685 } |
2686 |
2686 |
2687 // Define MAP_HUGETLB here so we can build HotSpot on old systems. |
2687 // Define MAP_HUGETLB here so we can build HotSpot on old systems. |
2688 #ifndef MAP_HUGETLB |
2688 #ifndef MAP_HUGETLB |
2714 assert(mesg != NULL, "mesg must be specified"); |
2714 assert(mesg != NULL, "mesg must be specified"); |
2715 int err = os::Linux::commit_memory_impl(addr, size, alignment_hint, exec); |
2715 int err = os::Linux::commit_memory_impl(addr, size, alignment_hint, exec); |
2716 if (err != 0) { |
2716 if (err != 0) { |
2717 // the caller wants all commit errors to exit with the specified mesg: |
2717 // the caller wants all commit errors to exit with the specified mesg: |
2718 warn_fail_commit_memory(addr, size, alignment_hint, exec, err); |
2718 warn_fail_commit_memory(addr, size, alignment_hint, exec, err); |
2719 vm_exit_out_of_memory(size, OOM_MMAP_ERROR, mesg); |
2719 vm_exit_out_of_memory(size, OOM_MMAP_ERROR, "%s", mesg); |
2720 } |
2720 } |
2721 } |
2721 } |
2722 |
2722 |
2723 void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) { |
2723 void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) { |
2724 if (UseTransparentHugePages && alignment_hint > (size_t)vm_page_size()) { |
2724 if (UseTransparentHugePages && alignment_hint > (size_t)vm_page_size()) { |
4276 // save the old handler in jvm |
4276 // save the old handler in jvm |
4277 save_preinstalled_handler(sig, oldAct); |
4277 save_preinstalled_handler(sig, oldAct); |
4278 // libjsig also interposes the sigaction() call below and saves the |
4278 // libjsig also interposes the sigaction() call below and saves the |
4279 // old sigaction on it own. |
4279 // old sigaction on it own. |
4280 } else { |
4280 } else { |
4281 fatal(err_msg("Encountered unexpected pre-existing sigaction handler " |
4281 fatal("Encountered unexpected pre-existing sigaction handler " |
4282 "%#lx for signal %d.", (long)oldhand, sig)); |
4282 "%#lx for signal %d.", (long)oldhand, sig); |
4283 } |
4283 } |
4284 } |
4284 } |
4285 |
4285 |
4286 struct sigaction sigAct; |
4286 struct sigaction sigAct; |
4287 sigfillset(&(sigAct.sa_mask)); |
4287 sigfillset(&(sigAct.sa_mask)); |
4609 |
4609 |
4610 ThreadCritical::initialize(); |
4610 ThreadCritical::initialize(); |
4611 |
4611 |
4612 Linux::set_page_size(sysconf(_SC_PAGESIZE)); |
4612 Linux::set_page_size(sysconf(_SC_PAGESIZE)); |
4613 if (Linux::page_size() == -1) { |
4613 if (Linux::page_size() == -1) { |
4614 fatal(err_msg("os_linux.cpp: os::init: sysconf failed (%s)", |
4614 fatal("os_linux.cpp: os::init: sysconf failed (%s)", |
4615 strerror(errno))); |
4615 strerror(errno)); |
4616 } |
4616 } |
4617 init_page_sizes((size_t) Linux::page_size()); |
4617 init_page_sizes((size_t) Linux::page_size()); |
4618 |
4618 |
4619 Linux::initialize_system_info(); |
4619 Linux::initialize_system_info(); |
4620 |
4620 |
4626 |
4626 |
4627 // pthread_condattr initialization for monotonic clock |
4627 // pthread_condattr initialization for monotonic clock |
4628 int status; |
4628 int status; |
4629 pthread_condattr_t* _condattr = os::Linux::condAttr(); |
4629 pthread_condattr_t* _condattr = os::Linux::condAttr(); |
4630 if ((status = pthread_condattr_init(_condattr)) != 0) { |
4630 if ((status = pthread_condattr_init(_condattr)) != 0) { |
4631 fatal(err_msg("pthread_condattr_init: %s", strerror(status))); |
4631 fatal("pthread_condattr_init: %s", strerror(status)); |
4632 } |
4632 } |
4633 // Only set the clock if CLOCK_MONOTONIC is available |
4633 // Only set the clock if CLOCK_MONOTONIC is available |
4634 if (os::supports_monotonic_clock()) { |
4634 if (os::supports_monotonic_clock()) { |
4635 if ((status = pthread_condattr_setclock(_condattr, CLOCK_MONOTONIC)) != 0) { |
4635 if ((status = pthread_condattr_setclock(_condattr, CLOCK_MONOTONIC)) != 0) { |
4636 if (status == EINVAL) { |
4636 if (status == EINVAL) { |
4637 warning("Unable to use monotonic clock with relative timed-waits" \ |
4637 warning("Unable to use monotonic clock with relative timed-waits" \ |
4638 " - changes to the time-of-day clock may have adverse affects"); |
4638 " - changes to the time-of-day clock may have adverse affects"); |
4639 } else { |
4639 } else { |
4640 fatal(err_msg("pthread_condattr_setclock: %s", strerror(status))); |
4640 fatal("pthread_condattr_setclock: %s", strerror(status)); |
4641 } |
4641 } |
4642 } |
4642 } |
4643 } |
4643 } |
4644 // else it defaults to CLOCK_REALTIME |
4644 // else it defaults to CLOCK_REALTIME |
4645 |
4645 |