545 // then we append a fake suffix "hotspot/libjvm.so" to this path so
546 // it looks like libjvm.so is installed there
547 // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm.so.
548 //
549 // Otherwise exit.
550 //
551 // Important note: if the location of libjvm.so changes this
552 // code needs to be changed accordingly.
553
554 // Base path of extensions installed on the system.
555 #define SYS_EXT_DIR "/usr/jdk/packages"
556 #define EXTENSIONS_DIR "/lib/ext"
557
558 // Buffer that fits several sprintfs.
559 // Note that the space for the colon and the trailing null are provided
560 // by the nulls included by the sizeof operator.
561 const size_t bufsize =
562 MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
563 sizeof(SYS_EXT_DIR) + sizeof("/lib/"), // invariant ld_library_path
564 (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
565 char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
566
567 // sysclasspath, java_home, dll_dir
568 {
569 char *pslash;
570 os::jvm_path(buf, bufsize);
571
572 // Found the full path to libjvm.so.
573 // Now cut the path to <java_home>/jre if we can.
574 *(strrchr(buf, '/')) = '\0'; // Get rid of /libjvm.so.
575 pslash = strrchr(buf, '/');
576 if (pslash != NULL) {
577 *pslash = '\0'; // Get rid of /{client|server|hotspot}.
578 }
579 Arguments::set_dll_dir(buf);
580
581 if (pslash != NULL) {
582 pslash = strrchr(buf, '/');
583 if (pslash != NULL) {
584 *pslash = '\0'; // Get rid of /lib.
585 }
631 vm_exit_during_initialization("dlinfo SERINFO request", dlerror());
632 }
633
634 path = &info->dls_serpath[0];
635
636 // Note: Due to a legacy implementation, most of the library path
637 // is set in the launcher. This was to accomodate linking restrictions
638 // on legacy Solaris implementations (which are no longer supported).
639 // Eventually, all the library path setting will be done here.
640 //
641 // However, to prevent the proliferation of improperly built native
642 // libraries, the new path component /usr/jdk/packages is added here.
643
644 // Construct the invariant part of ld_library_path.
645 sprintf(common_path, SYS_EXT_DIR "/lib");
646
647 // Struct size is more than sufficient for the path components obtained
648 // through the dlinfo() call, so only add additional space for the path
649 // components explicitly added here.
650 size_t library_path_size = info->dls_size + strlen(common_path);
651 library_path = (char *)NEW_C_HEAP_ARRAY(char, library_path_size, mtInternal);
652 library_path[0] = '\0';
653
654 // Construct the desired Java library path from the linker's library
655 // search path.
656 //
657 // For compatibility, it is optimal that we insert the additional path
658 // components specific to the Java VM after those components specified
659 // in LD_LIBRARY_PATH (if any) but before those added by the ld.so
660 // infrastructure.
661 if (info->dls_cnt == 0) { // Not sure this can happen, but allow for it.
662 strcpy(library_path, common_path);
663 } else {
664 int inserted = 0;
665 int i;
666 for (i = 0; i < info->dls_cnt; i++, path++) {
667 uint_t flags = path->dls_flags & LA_SER_MASK;
668 if (((flags & LA_SER_LIBPATH) == 0) && !inserted) {
669 strcat(library_path, common_path);
670 strcat(library_path, os::path_separator());
671 inserted = 1;
|
545 // then we append a fake suffix "hotspot/libjvm.so" to this path so
546 // it looks like libjvm.so is installed there
547 // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm.so.
548 //
549 // Otherwise exit.
550 //
551 // Important note: if the location of libjvm.so changes this
552 // code needs to be changed accordingly.
553
554 // Base path of extensions installed on the system.
555 #define SYS_EXT_DIR "/usr/jdk/packages"
556 #define EXTENSIONS_DIR "/lib/ext"
557
558 // Buffer that fits several sprintfs.
559 // Note that the space for the colon and the trailing null are provided
560 // by the nulls included by the sizeof operator.
561 const size_t bufsize =
562 MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
563 sizeof(SYS_EXT_DIR) + sizeof("/lib/"), // invariant ld_library_path
564 (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
565 char *buf = NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
566
567 // sysclasspath, java_home, dll_dir
568 {
569 char *pslash;
570 os::jvm_path(buf, bufsize);
571
572 // Found the full path to libjvm.so.
573 // Now cut the path to <java_home>/jre if we can.
574 *(strrchr(buf, '/')) = '\0'; // Get rid of /libjvm.so.
575 pslash = strrchr(buf, '/');
576 if (pslash != NULL) {
577 *pslash = '\0'; // Get rid of /{client|server|hotspot}.
578 }
579 Arguments::set_dll_dir(buf);
580
581 if (pslash != NULL) {
582 pslash = strrchr(buf, '/');
583 if (pslash != NULL) {
584 *pslash = '\0'; // Get rid of /lib.
585 }
631 vm_exit_during_initialization("dlinfo SERINFO request", dlerror());
632 }
633
634 path = &info->dls_serpath[0];
635
636 // Note: Due to a legacy implementation, most of the library path
637 // is set in the launcher. This was to accomodate linking restrictions
638 // on legacy Solaris implementations (which are no longer supported).
639 // Eventually, all the library path setting will be done here.
640 //
641 // However, to prevent the proliferation of improperly built native
642 // libraries, the new path component /usr/jdk/packages is added here.
643
644 // Construct the invariant part of ld_library_path.
645 sprintf(common_path, SYS_EXT_DIR "/lib");
646
647 // Struct size is more than sufficient for the path components obtained
648 // through the dlinfo() call, so only add additional space for the path
649 // components explicitly added here.
650 size_t library_path_size = info->dls_size + strlen(common_path);
651 library_path = NEW_C_HEAP_ARRAY(char, library_path_size, mtInternal);
652 library_path[0] = '\0';
653
654 // Construct the desired Java library path from the linker's library
655 // search path.
656 //
657 // For compatibility, it is optimal that we insert the additional path
658 // components specific to the Java VM after those components specified
659 // in LD_LIBRARY_PATH (if any) but before those added by the ld.so
660 // infrastructure.
661 if (info->dls_cnt == 0) { // Not sure this can happen, but allow for it.
662 strcpy(library_path, common_path);
663 } else {
664 int inserted = 0;
665 int i;
666 for (i = 0; i < info->dls_cnt; i++, path++) {
667 uint_t flags = path->dls_flags & LA_SER_MASK;
668 if (((flags & LA_SER_LIBPATH) == 0) && !inserted) {
669 strcat(library_path, common_path);
670 strcat(library_path, os::path_separator());
671 inserted = 1;
|