src/os/aix/vm/os_aix.cpp

Print this page




 495   if (_can_use_64K_pages) {
 496     g_multipage_error = 0;
 497   }
 498 
 499   if (Verbose) {
 500     fprintf(stderr, "Data page size (C-Heap, bss, etc): %s\n", describe_pagesize(data_page_size));
 501     fprintf(stderr, "Thread stack page size (pthread): %s\n", describe_pagesize(_stack_page_size));
 502     fprintf(stderr, "Default shared memory page size: %s\n", describe_pagesize(_shm_default_page_size));
 503     fprintf(stderr, "Can use 64K pages dynamically with shared meory: %s\n", (_can_use_64K_pages ? "yes" :"no"));
 504     fprintf(stderr, "Can use 16M pages dynamically with shared memory: %s\n", (_can_use_16M_pages ? "yes" :"no"));
 505     fprintf(stderr, "Multipage error details: %d\n", g_multipage_error);
 506   }
 507 
 508 } // end os::Aix::query_multipage_support()
 509 
 510 // The code for this method was initially derived from the version in os_linux.cpp.
 511 void os::init_system_properties_values() {
 512 
 513 #define DEFAULT_LIBPATH "/usr/lib:/lib"
 514 #define EXTENSIONS_DIR  "/lib/ext"
 515 #define ENDORSED_DIR    "/lib/endorsed"
 516 
 517   // Buffer that fits several sprintfs.
 518   // Note that the space for the trailing null is provided
 519   // by the nulls included by the sizeof operator.
 520   const size_t bufsize =
 521     MAX3((size_t)MAXPATHLEN,  // For dll_dir & friends.
 522          (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR), // extensions dir
 523          (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
 524   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
 525 
 526   // sysclasspath, java_home, dll_dir
 527   {
 528     char *pslash;
 529     os::jvm_path(buf, bufsize);
 530 
 531     // Found the full path to libjvm.so.
 532     // Now cut the path to <java_home>/jre if we can.
 533     *(strrchr(buf, '/')) = '\0'; // Get rid of /libjvm.so.
 534     pslash = strrchr(buf, '/');
 535     if (pslash != NULL) {
 536       *pslash = '\0';            // Get rid of /{client|server|hotspot}.
 537     }
 538     Arguments::set_dll_dir(buf);
 539 
 540     if (pslash != NULL) {
 541       pslash = strrchr(buf, '/');
 542       if (pslash != NULL) {
 543         *pslash = '\0';          // Get rid of /<arch>.


 554   // Where to look for native libraries.
 555 
 556   // On Aix we get the user setting of LIBPATH.
 557   // Eventually, all the library path setting will be done here.
 558   // Get the user setting of LIBPATH.
 559   const char *v = ::getenv("LIBPATH");
 560   const char *v_colon = ":";
 561   if (v == NULL) { v = ""; v_colon = ""; }
 562 
 563   // Concatenate user and invariant part of ld_library_path.
 564   // That's +1 for the colon and +1 for the trailing '\0'.
 565   char *ld_library_path = (char *)NEW_C_HEAP_ARRAY(char, strlen(v) + 1 + sizeof(DEFAULT_LIBPATH) + 1, mtInternal);
 566   sprintf(ld_library_path, "%s%s" DEFAULT_LIBPATH, v, v_colon);
 567   Arguments::set_library_path(ld_library_path);
 568   FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
 569 
 570   // Extensions directories.
 571   sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
 572   Arguments::set_ext_dirs(buf);
 573 
 574   // Endorsed standards default directory.
 575   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
 576   Arguments::set_endorsed_dirs(buf);
 577 
 578   FREE_C_HEAP_ARRAY(char, buf, mtInternal);
 579 
 580 #undef DEFAULT_LIBPATH
 581 #undef EXTENSIONS_DIR
 582 #undef ENDORSED_DIR
 583 }
 584 
 585 ////////////////////////////////////////////////////////////////////////////////
 586 // breakpoint support
 587 
 588 void os::breakpoint() {
 589   BREAKPOINT;
 590 }
 591 
 592 extern "C" void breakpoint() {
 593   // use debugger to set breakpoint here
 594 }
 595 
 596 ////////////////////////////////////////////////////////////////////////////////
 597 // signal support
 598 
 599 debug_only(static bool signal_sets_initialized = false);
 600 static sigset_t unblocked_sigs, vm_sigs, allowdebug_blocked_sigs;
 601 
 602 bool os::Aix::is_sig_ignored(int sig) {


2761 
2762   char* addr = NULL;
2763   if (use_mmap) {
2764     addr = reserve_mmaped_memory(bytes, requested_addr);
2765   } else {
2766     // shmat: wish address is mandatory, and do not try 16M pages here.
2767     shmatted_memory_info_t info;
2768     const int flags = RESSHM_WISHADDR_OR_FAIL;
2769     if (reserve_shmatted_memory(bytes, requested_addr, flags, &info)) {
2770       addr = info.addr;
2771     }
2772   }
2773 
2774   return addr;
2775 }
2776 
2777 size_t os::read(int fd, void *buf, unsigned int nBytes) {
2778   return ::read(fd, buf, nBytes);
2779 }
2780 




2781 void os::naked_short_sleep(jlong ms) {
2782   struct timespec req;
2783 
2784   assert(ms < 1000, "Un-interruptable sleep, short time use only");
2785   req.tv_sec = 0;
2786   if (ms > 0) {
2787     req.tv_nsec = (ms % 1000) * 1000000;
2788   }
2789   else {
2790     req.tv_nsec = 1;
2791   }
2792 
2793   nanosleep(&req, NULL);
2794 
2795   return;
2796 }
2797 
2798 // Sleep forever; naked call to OS-specific sleep; use with CAUTION
2799 void os::infinite_sleep() {
2800   while (true) {    // sleep forever ...




 495   if (_can_use_64K_pages) {
 496     g_multipage_error = 0;
 497   }
 498 
 499   if (Verbose) {
 500     fprintf(stderr, "Data page size (C-Heap, bss, etc): %s\n", describe_pagesize(data_page_size));
 501     fprintf(stderr, "Thread stack page size (pthread): %s\n", describe_pagesize(_stack_page_size));
 502     fprintf(stderr, "Default shared memory page size: %s\n", describe_pagesize(_shm_default_page_size));
 503     fprintf(stderr, "Can use 64K pages dynamically with shared meory: %s\n", (_can_use_64K_pages ? "yes" :"no"));
 504     fprintf(stderr, "Can use 16M pages dynamically with shared memory: %s\n", (_can_use_16M_pages ? "yes" :"no"));
 505     fprintf(stderr, "Multipage error details: %d\n", g_multipage_error);
 506   }
 507 
 508 } // end os::Aix::query_multipage_support()
 509 
 510 // The code for this method was initially derived from the version in os_linux.cpp.
 511 void os::init_system_properties_values() {
 512 
 513 #define DEFAULT_LIBPATH "/usr/lib:/lib"
 514 #define EXTENSIONS_DIR  "/lib/ext"

 515 
 516   // Buffer that fits several sprintfs.
 517   // Note that the space for the trailing null is provided
 518   // by the nulls included by the sizeof operator.
 519   const size_t bufsize =
 520     MAX2((size_t)MAXPATHLEN,  // For dll_dir & friends.
 521          (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR)); // extensions dir

 522   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
 523 
 524   // sysclasspath, java_home, dll_dir
 525   {
 526     char *pslash;
 527     os::jvm_path(buf, bufsize);
 528 
 529     // Found the full path to libjvm.so.
 530     // Now cut the path to <java_home>/jre if we can.
 531     *(strrchr(buf, '/')) = '\0'; // Get rid of /libjvm.so.
 532     pslash = strrchr(buf, '/');
 533     if (pslash != NULL) {
 534       *pslash = '\0';            // Get rid of /{client|server|hotspot}.
 535     }
 536     Arguments::set_dll_dir(buf);
 537 
 538     if (pslash != NULL) {
 539       pslash = strrchr(buf, '/');
 540       if (pslash != NULL) {
 541         *pslash = '\0';          // Get rid of /<arch>.


 552   // Where to look for native libraries.
 553 
 554   // On Aix we get the user setting of LIBPATH.
 555   // Eventually, all the library path setting will be done here.
 556   // Get the user setting of LIBPATH.
 557   const char *v = ::getenv("LIBPATH");
 558   const char *v_colon = ":";
 559   if (v == NULL) { v = ""; v_colon = ""; }
 560 
 561   // Concatenate user and invariant part of ld_library_path.
 562   // That's +1 for the colon and +1 for the trailing '\0'.
 563   char *ld_library_path = (char *)NEW_C_HEAP_ARRAY(char, strlen(v) + 1 + sizeof(DEFAULT_LIBPATH) + 1, mtInternal);
 564   sprintf(ld_library_path, "%s%s" DEFAULT_LIBPATH, v, v_colon);
 565   Arguments::set_library_path(ld_library_path);
 566   FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
 567 
 568   // Extensions directories.
 569   sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
 570   Arguments::set_ext_dirs(buf);
 571 




 572   FREE_C_HEAP_ARRAY(char, buf, mtInternal);
 573 
 574 #undef DEFAULT_LIBPATH
 575 #undef EXTENSIONS_DIR

 576 }
 577 
 578 ////////////////////////////////////////////////////////////////////////////////
 579 // breakpoint support
 580 
 581 void os::breakpoint() {
 582   BREAKPOINT;
 583 }
 584 
 585 extern "C" void breakpoint() {
 586   // use debugger to set breakpoint here
 587 }
 588 
 589 ////////////////////////////////////////////////////////////////////////////////
 590 // signal support
 591 
 592 debug_only(static bool signal_sets_initialized = false);
 593 static sigset_t unblocked_sigs, vm_sigs, allowdebug_blocked_sigs;
 594 
 595 bool os::Aix::is_sig_ignored(int sig) {


2754 
2755   char* addr = NULL;
2756   if (use_mmap) {
2757     addr = reserve_mmaped_memory(bytes, requested_addr);
2758   } else {
2759     // shmat: wish address is mandatory, and do not try 16M pages here.
2760     shmatted_memory_info_t info;
2761     const int flags = RESSHM_WISHADDR_OR_FAIL;
2762     if (reserve_shmatted_memory(bytes, requested_addr, flags, &info)) {
2763       addr = info.addr;
2764     }
2765   }
2766 
2767   return addr;
2768 }
2769 
2770 size_t os::read(int fd, void *buf, unsigned int nBytes) {
2771   return ::read(fd, buf, nBytes);
2772 }
2773 
2774 size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
2775   return ::pread(fd, buf, nBytes, offset);
2776 }
2777 
2778 void os::naked_short_sleep(jlong ms) {
2779   struct timespec req;
2780 
2781   assert(ms < 1000, "Un-interruptable sleep, short time use only");
2782   req.tv_sec = 0;
2783   if (ms > 0) {
2784     req.tv_nsec = (ms % 1000) * 1000000;
2785   }
2786   else {
2787     req.tv_nsec = 1;
2788   }
2789 
2790   nanosleep(&req, NULL);
2791 
2792   return;
2793 }
2794 
2795 // Sleep forever; naked call to OS-specific sleep; use with CAUTION
2796 void os::infinite_sleep() {
2797   while (true) {    // sleep forever ...