hotspot/src/os/linux/vm/os_linux.cpp
changeset 27164 6523fa019ffa
parent 27157 364276bc8d8b
child 27400 c5955f4b7c84
equal deleted inserted replaced
27163:66521b7ba8d6 27164:6523fa019ffa
   127 address   os::Linux::_initial_thread_stack_bottom = NULL;
   127 address   os::Linux::_initial_thread_stack_bottom = NULL;
   128 uintptr_t os::Linux::_initial_thread_stack_size   = 0;
   128 uintptr_t os::Linux::_initial_thread_stack_size   = 0;
   129 
   129 
   130 int (*os::Linux::_clock_gettime)(clockid_t, struct timespec *) = NULL;
   130 int (*os::Linux::_clock_gettime)(clockid_t, struct timespec *) = NULL;
   131 int (*os::Linux::_pthread_getcpuclockid)(pthread_t, clockid_t *) = NULL;
   131 int (*os::Linux::_pthread_getcpuclockid)(pthread_t, clockid_t *) = NULL;
       
   132 int (*os::Linux::_pthread_setname_np)(pthread_t, const char*) = NULL;
   132 Mutex* os::Linux::_createThread_lock = NULL;
   133 Mutex* os::Linux::_createThread_lock = NULL;
   133 pthread_t os::Linux::_main_thread;
   134 pthread_t os::Linux::_main_thread;
   134 int os::Linux::_page_size = -1;
   135 int os::Linux::_page_size = -1;
   135 const int os::Linux::_vm_default_page_size = (8 * K);
   136 const int os::Linux::_vm_default_page_size = (8 * K);
   136 bool os::Linux::_is_floating_stack = false;
   137 bool os::Linux::_is_floating_stack = false;
  4693   if (vm_page_size() > (int)Linux::vm_default_page_size()) {
  4694   if (vm_page_size() > (int)Linux::vm_default_page_size()) {
  4694     StackYellowPages = 1;
  4695     StackYellowPages = 1;
  4695     StackRedPages = 1;
  4696     StackRedPages = 1;
  4696     StackShadowPages = round_to((StackShadowPages*Linux::vm_default_page_size()), vm_page_size()) / vm_page_size();
  4697     StackShadowPages = round_to((StackShadowPages*Linux::vm_default_page_size()), vm_page_size()) / vm_page_size();
  4697   }
  4698   }
       
  4699 
       
  4700   // retrieve entry point for pthread_setname_np
       
  4701   Linux::_pthread_setname_np =
       
  4702     (int(*)(pthread_t, const char*))dlsym(RTLD_DEFAULT, "pthread_setname_np");
       
  4703 
  4698 }
  4704 }
  4699 
  4705 
  4700 // To install functions for atexit system call
  4706 // To install functions for atexit system call
  4701 extern "C" {
  4707 extern "C" {
  4702   static void perfMemory_exit_helper() {
  4708   static void perfMemory_exit_helper() {
  4892   assert(online_cpus > 0 && online_cpus <= processor_count(), "sanity check");
  4898   assert(online_cpus > 0 && online_cpus <= processor_count(), "sanity check");
  4893   return online_cpus;
  4899   return online_cpus;
  4894 }
  4900 }
  4895 
  4901 
  4896 void os::set_native_thread_name(const char *name) {
  4902 void os::set_native_thread_name(const char *name) {
  4897   // Not yet implemented.
  4903   if (Linux::_pthread_setname_np) {
  4898   return;
  4904     char buf [16]; // according to glibc manpage, 16 chars incl. '/0'
       
  4905     snprintf(buf, sizeof(buf), "%s", name);
       
  4906     buf[sizeof(buf) - 1] = '\0';
       
  4907     const int rc = Linux::_pthread_setname_np(pthread_self(), buf);
       
  4908     // ERANGE should not happen; all other errors should just be ignored.
       
  4909     assert(rc != ERANGE, "pthread_setname_np failed");
       
  4910   }
  4899 }
  4911 }
  4900 
  4912 
  4901 bool os::distribute_processes(uint length, uint* distribution) {
  4913 bool os::distribute_processes(uint length, uint* distribution) {
  4902   // Not yet implemented.
  4914   // Not yet implemented.
  4903   return false;
  4915   return false;