src/os/solaris/vm/os_solaris.cpp

Print this page




 592   // Otherwise exit with message: "Could not create the Java virtual machine."
 593   //
 594   // The following extra steps are taken in the debugging version:
 595   //
 596   // If "/jre/lib/" does NOT appear at the right place in the path
 597   // instead of exit check for $JAVA_HOME environment variable.
 598   //
 599   // If it is defined and we are able to locate $JAVA_HOME/jre/lib/<arch>,
 600   // then we append a fake suffix "hotspot/libjvm.so" to this path so
 601   // it looks like libjvm.so is installed there
 602   // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm.so.
 603   //
 604   // Otherwise exit.
 605   //
 606   // Important note: if the location of libjvm.so changes this
 607   // code needs to be changed accordingly.
 608 
 609 // Base path of extensions installed on the system.
 610 #define SYS_EXT_DIR     "/usr/jdk/packages"
 611 #define EXTENSIONS_DIR  "/lib/ext"
 612 #define ENDORSED_DIR    "/lib/endorsed"
 613 
 614   char cpu_arch[12];
 615   // Buffer that fits several sprintfs.
 616   // Note that the space for the colon and the trailing null are provided
 617   // by the nulls included by the sizeof operator.
 618   const size_t bufsize =
 619     MAX4((size_t)MAXPATHLEN,  // For dll_dir & friends.
 620          sizeof(SYS_EXT_DIR) + sizeof("/lib/") + strlen(cpu_arch), // invariant ld_library_path
 621          (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
 622          (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
 623   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
 624 
 625   // sysclasspath, java_home, dll_dir
 626   {
 627     char *pslash;
 628     os::jvm_path(buf, bufsize);
 629 
 630     // Found the full path to libjvm.so.
 631     // Now cut the path to <java_home>/jre if we can.
 632     *(strrchr(buf, '/')) = '\0'; // Get rid of /libjvm.so.
 633     pslash = strrchr(buf, '/');
 634     if (pslash != NULL) {
 635       *pslash = '\0';            // Get rid of /{client|server|hotspot}.
 636     }
 637     Arguments::set_dll_dir(buf);
 638 
 639     if (pslash != NULL) {
 640       pslash = strrchr(buf, '/');
 641       if (pslash != NULL) {
 642         *pslash = '\0';          // Get rid of /<arch>.


 748       }
 749       // Eliminate trailing path separator.
 750       library_path[strlen(library_path)-1] = '\0';
 751     }
 752 
 753     // happens before argument parsing - can't use a trace flag
 754     // tty->print_raw("init_system_properties_values: native lib path: ");
 755     // tty->print_raw_cr(library_path);
 756 
 757     // Callee copies into its own buffer.
 758     Arguments::set_library_path(library_path);
 759 
 760     FREE_C_HEAP_ARRAY(char, library_path, mtInternal);
 761     FREE_C_HEAP_ARRAY(char, info, mtInternal);
 762   }
 763 
 764   // Extensions directories.
 765   sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
 766   Arguments::set_ext_dirs(buf);
 767 
 768   // Endorsed standards default directory.
 769   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
 770   Arguments::set_endorsed_dirs(buf);
 771 
 772   FREE_C_HEAP_ARRAY(char, buf, mtInternal);
 773 
 774 #undef SYS_EXT_DIR
 775 #undef EXTENSIONS_DIR
 776 #undef ENDORSED_DIR
 777 }
 778 
 779 void os::breakpoint() {
 780   BREAKPOINT;
 781 }
 782 
 783 bool os::obsolete_option(const JavaVMOption *option) {
 784   if (!strncmp(option->optionString, "-Xt", 3)) {
 785     return true;
 786   } else if (!strncmp(option->optionString, "-Xtm", 4)) {
 787     return true;
 788   } else if (!strncmp(option->optionString, "-Xverifyheap", 12)) {
 789     return true;
 790   } else if (!strncmp(option->optionString, "-Xmaxjitcodesize", 16)) {
 791     return true;
 792   }
 793   return false;
 794 }
 795 
 796 bool os::Solaris::valid_stack_address(Thread* thread, address sp) {


3147 // MPSS allows application to commit large page memory on demand; with ISM
3148 // the entire memory region must be allocated as shared memory.
3149 bool os::can_commit_large_page_memory() {
3150   return true;
3151 }
3152 
3153 bool os::can_execute_large_page_memory() {
3154   return true;
3155 }
3156 
3157 // Read calls from inside the vm need to perform state transitions
3158 size_t os::read(int fd, void *buf, unsigned int nBytes) {
3159   size_t res;
3160   JavaThread* thread = (JavaThread*)Thread::current();
3161   assert(thread->thread_state() == _thread_in_vm, "Assumed _thread_in_vm");
3162   ThreadBlockInVM tbiv(thread);
3163   RESTARTABLE(::read(fd, buf, (size_t) nBytes), res);
3164   return res;
3165 }
3166 









3167 size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
3168   size_t res;
3169   assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native,
3170          "Assumed _thread_in_native");
3171   RESTARTABLE(::read(fd, buf, (size_t) nBytes), res);
3172   return res;
3173 }
3174 
3175 void os::naked_short_sleep(jlong ms) {
3176   assert(ms < 1000, "Un-interruptable sleep, short time use only");
3177 
3178   // usleep is deprecated and removed from POSIX, in favour of nanosleep, but
3179   // Solaris requires -lrt for this.
3180   usleep((ms * 1000));
3181 
3182   return;
3183 }
3184 
3185 // Sleep forever; naked call to OS-specific sleep; use with CAUTION
3186 void os::infinite_sleep() {




 592   // Otherwise exit with message: "Could not create the Java virtual machine."
 593   //
 594   // The following extra steps are taken in the debugging version:
 595   //
 596   // If "/jre/lib/" does NOT appear at the right place in the path
 597   // instead of exit check for $JAVA_HOME environment variable.
 598   //
 599   // If it is defined and we are able to locate $JAVA_HOME/jre/lib/<arch>,
 600   // then we append a fake suffix "hotspot/libjvm.so" to this path so
 601   // it looks like libjvm.so is installed there
 602   // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm.so.
 603   //
 604   // Otherwise exit.
 605   //
 606   // Important note: if the location of libjvm.so changes this
 607   // code needs to be changed accordingly.
 608 
 609 // Base path of extensions installed on the system.
 610 #define SYS_EXT_DIR     "/usr/jdk/packages"
 611 #define EXTENSIONS_DIR  "/lib/ext"

 612 
 613   char cpu_arch[12];
 614   // Buffer that fits several sprintfs.
 615   // Note that the space for the colon and the trailing null are provided
 616   // by the nulls included by the sizeof operator.
 617   const size_t bufsize =
 618     MAX3((size_t)MAXPATHLEN,  // For dll_dir & friends.
 619          sizeof(SYS_EXT_DIR) + sizeof("/lib/") + strlen(cpu_arch), // invariant ld_library_path
 620          (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir

 621   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
 622 
 623   // sysclasspath, java_home, dll_dir
 624   {
 625     char *pslash;
 626     os::jvm_path(buf, bufsize);
 627 
 628     // Found the full path to libjvm.so.
 629     // Now cut the path to <java_home>/jre if we can.
 630     *(strrchr(buf, '/')) = '\0'; // Get rid of /libjvm.so.
 631     pslash = strrchr(buf, '/');
 632     if (pslash != NULL) {
 633       *pslash = '\0';            // Get rid of /{client|server|hotspot}.
 634     }
 635     Arguments::set_dll_dir(buf);
 636 
 637     if (pslash != NULL) {
 638       pslash = strrchr(buf, '/');
 639       if (pslash != NULL) {
 640         *pslash = '\0';          // Get rid of /<arch>.


 746       }
 747       // Eliminate trailing path separator.
 748       library_path[strlen(library_path)-1] = '\0';
 749     }
 750 
 751     // happens before argument parsing - can't use a trace flag
 752     // tty->print_raw("init_system_properties_values: native lib path: ");
 753     // tty->print_raw_cr(library_path);
 754 
 755     // Callee copies into its own buffer.
 756     Arguments::set_library_path(library_path);
 757 
 758     FREE_C_HEAP_ARRAY(char, library_path, mtInternal);
 759     FREE_C_HEAP_ARRAY(char, info, mtInternal);
 760   }
 761 
 762   // Extensions directories.
 763   sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
 764   Arguments::set_ext_dirs(buf);
 765 




 766   FREE_C_HEAP_ARRAY(char, buf, mtInternal);
 767 
 768 #undef SYS_EXT_DIR
 769 #undef EXTENSIONS_DIR

 770 }
 771 
 772 void os::breakpoint() {
 773   BREAKPOINT;
 774 }
 775 
 776 bool os::obsolete_option(const JavaVMOption *option) {
 777   if (!strncmp(option->optionString, "-Xt", 3)) {
 778     return true;
 779   } else if (!strncmp(option->optionString, "-Xtm", 4)) {
 780     return true;
 781   } else if (!strncmp(option->optionString, "-Xverifyheap", 12)) {
 782     return true;
 783   } else if (!strncmp(option->optionString, "-Xmaxjitcodesize", 16)) {
 784     return true;
 785   }
 786   return false;
 787 }
 788 
 789 bool os::Solaris::valid_stack_address(Thread* thread, address sp) {


3140 // MPSS allows application to commit large page memory on demand; with ISM
3141 // the entire memory region must be allocated as shared memory.
3142 bool os::can_commit_large_page_memory() {
3143   return true;
3144 }
3145 
3146 bool os::can_execute_large_page_memory() {
3147   return true;
3148 }
3149 
3150 // Read calls from inside the vm need to perform state transitions
3151 size_t os::read(int fd, void *buf, unsigned int nBytes) {
3152   size_t res;
3153   JavaThread* thread = (JavaThread*)Thread::current();
3154   assert(thread->thread_state() == _thread_in_vm, "Assumed _thread_in_vm");
3155   ThreadBlockInVM tbiv(thread);
3156   RESTARTABLE(::read(fd, buf, (size_t) nBytes), res);
3157   return res;
3158 }
3159 
3160 size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
3161   size_t res;
3162   JavaThread* thread = (JavaThread*)Thread::current();
3163   assert(thread->thread_state() == _thread_in_vm, "Assumed _thread_in_vm");
3164   ThreadBlockInVM tbiv(thread);
3165   RESTARTABLE(::pread(fd, buf, (size_t) nBytes, offset), res);
3166   return res;
3167 }
3168 
3169 size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
3170   size_t res;
3171   assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native,
3172          "Assumed _thread_in_native");
3173   RESTARTABLE(::read(fd, buf, (size_t) nBytes), res);
3174   return res;
3175 }
3176 
3177 void os::naked_short_sleep(jlong ms) {
3178   assert(ms < 1000, "Un-interruptable sleep, short time use only");
3179 
3180   // usleep is deprecated and removed from POSIX, in favour of nanosleep, but
3181   // Solaris requires -lrt for this.
3182   usleep((ms * 1000));
3183 
3184   return;
3185 }
3186 
3187 // Sleep forever; naked call to OS-specific sleep; use with CAUTION
3188 void os::infinite_sleep() {