732 char arch[12]; |
732 char arch[12]; |
733 sysinfo(SI_ARCHITECTURE, arch, sizeof(arch)); |
733 sysinfo(SI_ARCHITECTURE, arch, sizeof(arch)); |
734 |
734 |
735 // The next steps are taken in the product version: |
735 // The next steps are taken in the product version: |
736 // |
736 // |
737 // Obtain the JAVA_HOME value from the location of libjvm[_g].so. |
737 // Obtain the JAVA_HOME value from the location of libjvm.so. |
738 // This library should be located at: |
738 // This library should be located at: |
739 // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm[_g].so. |
739 // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm.so. |
740 // |
740 // |
741 // If "/jre/lib/" appears at the right place in the path, then we |
741 // If "/jre/lib/" appears at the right place in the path, then we |
742 // assume libjvm[_g].so is installed in a JDK and we use this path. |
742 // assume libjvm.so is installed in a JDK and we use this path. |
743 // |
743 // |
744 // Otherwise exit with message: "Could not create the Java virtual machine." |
744 // Otherwise exit with message: "Could not create the Java virtual machine." |
745 // |
745 // |
746 // The following extra steps are taken in the debugging version: |
746 // The following extra steps are taken in the debugging version: |
747 // |
747 // |
748 // If "/jre/lib/" does NOT appear at the right place in the path |
748 // If "/jre/lib/" does NOT appear at the right place in the path |
749 // instead of exit check for $JAVA_HOME environment variable. |
749 // instead of exit check for $JAVA_HOME environment variable. |
750 // |
750 // |
751 // If it is defined and we are able to locate $JAVA_HOME/jre/lib/<arch>, |
751 // If it is defined and we are able to locate $JAVA_HOME/jre/lib/<arch>, |
752 // then we append a fake suffix "hotspot/libjvm[_g].so" to this path so |
752 // then we append a fake suffix "hotspot/libjvm.so" to this path so |
753 // it looks like libjvm[_g].so is installed there |
753 // it looks like libjvm.so is installed there |
754 // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm[_g].so. |
754 // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm.so. |
755 // |
755 // |
756 // Otherwise exit. |
756 // Otherwise exit. |
757 // |
757 // |
758 // Important note: if the location of libjvm.so changes this |
758 // Important note: if the location of libjvm.so changes this |
759 // code needs to be changed accordingly. |
759 // code needs to be changed accordingly. |
1932 |
1932 |
1933 const char* os::get_current_directory(char *buf, int buflen) { |
1933 const char* os::get_current_directory(char *buf, int buflen) { |
1934 return getcwd(buf, buflen); |
1934 return getcwd(buf, buflen); |
1935 } |
1935 } |
1936 |
1936 |
1937 // check if addr is inside libjvm[_g].so |
1937 // check if addr is inside libjvm.so |
1938 bool os::address_is_in_vm(address addr) { |
1938 bool os::address_is_in_vm(address addr) { |
1939 static address libjvm_base_addr; |
1939 static address libjvm_base_addr; |
1940 Dl_info dlinfo; |
1940 Dl_info dlinfo; |
1941 |
1941 |
1942 if (libjvm_base_addr == NULL) { |
1942 if (libjvm_base_addr == NULL) { |
2472 print_signal_handler(st, os::Solaris::SIGasync(), buf, buflen); |
2472 print_signal_handler(st, os::Solaris::SIGasync(), buf, buflen); |
2473 } |
2473 } |
2474 |
2474 |
2475 static char saved_jvm_path[MAXPATHLEN] = { 0 }; |
2475 static char saved_jvm_path[MAXPATHLEN] = { 0 }; |
2476 |
2476 |
2477 // Find the full path to the current module, libjvm.so or libjvm_g.so |
2477 // Find the full path to the current module, libjvm.so |
2478 void os::jvm_path(char *buf, jint buflen) { |
2478 void os::jvm_path(char *buf, jint buflen) { |
2479 // Error checking. |
2479 // Error checking. |
2480 if (buflen < MAXPATHLEN) { |
2480 if (buflen < MAXPATHLEN) { |
2481 assert(false, "must use a large-enough buffer"); |
2481 assert(false, "must use a large-enough buffer"); |
2482 buf[0] = '\0'; |
2482 buf[0] = '\0'; |
2520 strcat(cpu_arch, "v9"); |
2520 strcat(cpu_arch, "v9"); |
2521 } else if (strcmp(cpu_arch, "i386") == 0) { |
2521 } else if (strcmp(cpu_arch, "i386") == 0) { |
2522 strcpy(cpu_arch, "amd64"); |
2522 strcpy(cpu_arch, "amd64"); |
2523 } |
2523 } |
2524 #endif |
2524 #endif |
2525 // Check the current module name "libjvm.so" or "libjvm_g.so". |
2525 // Check the current module name "libjvm.so". |
2526 p = strrchr(buf, '/'); |
2526 p = strrchr(buf, '/'); |
2527 assert(strstr(p, "/libjvm") == p, "invalid library name"); |
2527 assert(strstr(p, "/libjvm") == p, "invalid library name"); |
2528 p = strstr(p, "_g") ? "_g" : ""; |
|
2529 |
2528 |
2530 realpath(java_home_var, buf); |
2529 realpath(java_home_var, buf); |
2531 // determine if this is a legacy image or modules image |
2530 // determine if this is a legacy image or modules image |
2532 // modules image doesn't have "jre" subdirectory |
2531 // modules image doesn't have "jre" subdirectory |
2533 len = strlen(buf); |
2532 len = strlen(buf); |
2536 if (0 != access(buf, F_OK)) { |
2535 if (0 != access(buf, F_OK)) { |
2537 snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch); |
2536 snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch); |
2538 } |
2537 } |
2539 |
2538 |
2540 if (0 == access(buf, F_OK)) { |
2539 if (0 == access(buf, F_OK)) { |
2541 // Use current module name "libjvm[_g].so" instead of |
2540 // Use current module name "libjvm.so" |
2542 // "libjvm"debug_only("_g")".so" since for fastdebug version |
|
2543 // we should have "libjvm.so" but debug_only("_g") adds "_g"! |
|
2544 len = strlen(buf); |
2541 len = strlen(buf); |
2545 snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p); |
2542 snprintf(buf + len, buflen-len, "/hotspot/libjvm.so"); |
2546 } else { |
2543 } else { |
2547 // Go back to path of .so |
2544 // Go back to path of .so |
2548 realpath((char *)dlinfo.dli_fname, buf); |
2545 realpath((char *)dlinfo.dli_fname, buf); |
2549 } |
2546 } |
2550 } |
2547 } |