< prev index next >

src/hotspot/os/linux/os_linux.cpp

Print this page

 411 #ifndef OVERRIDE_LIBPATH
 412   #if defined(AMD64) || (defined(_LP64) && defined(SPARC)) || defined(PPC64) || defined(S390)
 413     #define DEFAULT_LIBPATH "/usr/lib64:/lib64:/lib:/usr/lib"
 414   #else
 415     #define DEFAULT_LIBPATH "/lib:/usr/lib"
 416   #endif
 417 #else
 418   #define DEFAULT_LIBPATH OVERRIDE_LIBPATH
 419 #endif
 420 
 421 // Base path of extensions installed on the system.
 422 #define SYS_EXT_DIR     "/usr/java/packages"
 423 #define EXTENSIONS_DIR  "/lib/ext"
 424 
 425   // Buffer that fits several sprintfs.
 426   // Note that the space for the colon and the trailing null are provided
 427   // by the nulls included by the sizeof operator.
 428   const size_t bufsize =
 429     MAX2((size_t)MAXPATHLEN,  // For dll_dir & friends.
 430          (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
 431   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
 432 
 433   // sysclasspath, java_home, dll_dir
 434   {
 435     char *pslash;
 436     os::jvm_path(buf, bufsize);
 437 
 438     // Found the full path to libjvm.so.
 439     // Now cut the path to <java_home>/jre if we can.
 440     pslash = strrchr(buf, '/');
 441     if (pslash != NULL) {
 442       *pslash = '\0';            // Get rid of /libjvm.so.
 443     }
 444     pslash = strrchr(buf, '/');
 445     if (pslash != NULL) {
 446       *pslash = '\0';            // Get rid of /{client|server|hotspot}.
 447     }
 448     Arguments::set_dll_dir(buf);
 449 
 450     if (pslash != NULL) {
 451       pslash = strrchr(buf, '/');

 460   }
 461 
 462   // Where to look for native libraries.
 463   //
 464   // Note: Due to a legacy implementation, most of the library path
 465   // is set in the launcher. This was to accomodate linking restrictions
 466   // on legacy Linux implementations (which are no longer supported).
 467   // Eventually, all the library path setting will be done here.
 468   //
 469   // However, to prevent the proliferation of improperly built native
 470   // libraries, the new path component /usr/java/packages is added here.
 471   // Eventually, all the library path setting will be done here.
 472   {
 473     // Get the user setting of LD_LIBRARY_PATH, and prepended it. It
 474     // should always exist (until the legacy problem cited above is
 475     // addressed).
 476     const char *v = ::getenv("LD_LIBRARY_PATH");
 477     const char *v_colon = ":";
 478     if (v == NULL) { v = ""; v_colon = ""; }
 479     // That's +1 for the colon and +1 for the trailing '\0'.
 480     char *ld_library_path = (char *)NEW_C_HEAP_ARRAY(char,
 481                                                      strlen(v) + 1 +
 482                                                      sizeof(SYS_EXT_DIR) + sizeof("/lib/") + sizeof(DEFAULT_LIBPATH) + 1,
 483                                                      mtInternal);
 484     sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib:" DEFAULT_LIBPATH, v, v_colon);
 485     Arguments::set_library_path(ld_library_path);
 486     FREE_C_HEAP_ARRAY(char, ld_library_path);
 487   }
 488 
 489   // Extensions directories.
 490   sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
 491   Arguments::set_ext_dirs(buf);
 492 
 493   FREE_C_HEAP_ARRAY(char, buf);
 494 
 495 #undef DEFAULT_LIBPATH
 496 #undef SYS_EXT_DIR
 497 #undef EXTENSIONS_DIR
 498 }
 499 
 500 ////////////////////////////////////////////////////////////////////////////////
 501 // breakpoint support
 502 
 503 void os::breakpoint() {

 411 #ifndef OVERRIDE_LIBPATH
 412   #if defined(AMD64) || (defined(_LP64) && defined(SPARC)) || defined(PPC64) || defined(S390)
 413     #define DEFAULT_LIBPATH "/usr/lib64:/lib64:/lib:/usr/lib"
 414   #else
 415     #define DEFAULT_LIBPATH "/lib:/usr/lib"
 416   #endif
 417 #else
 418   #define DEFAULT_LIBPATH OVERRIDE_LIBPATH
 419 #endif
 420 
 421 // Base path of extensions installed on the system.
 422 #define SYS_EXT_DIR     "/usr/java/packages"
 423 #define EXTENSIONS_DIR  "/lib/ext"
 424 
 425   // Buffer that fits several sprintfs.
 426   // Note that the space for the colon and the trailing null are provided
 427   // by the nulls included by the sizeof operator.
 428   const size_t bufsize =
 429     MAX2((size_t)MAXPATHLEN,  // For dll_dir & friends.
 430          (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
 431   char *buf = NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
 432 
 433   // sysclasspath, java_home, dll_dir
 434   {
 435     char *pslash;
 436     os::jvm_path(buf, bufsize);
 437 
 438     // Found the full path to libjvm.so.
 439     // Now cut the path to <java_home>/jre if we can.
 440     pslash = strrchr(buf, '/');
 441     if (pslash != NULL) {
 442       *pslash = '\0';            // Get rid of /libjvm.so.
 443     }
 444     pslash = strrchr(buf, '/');
 445     if (pslash != NULL) {
 446       *pslash = '\0';            // Get rid of /{client|server|hotspot}.
 447     }
 448     Arguments::set_dll_dir(buf);
 449 
 450     if (pslash != NULL) {
 451       pslash = strrchr(buf, '/');

 460   }
 461 
 462   // Where to look for native libraries.
 463   //
 464   // Note: Due to a legacy implementation, most of the library path
 465   // is set in the launcher. This was to accomodate linking restrictions
 466   // on legacy Linux implementations (which are no longer supported).
 467   // Eventually, all the library path setting will be done here.
 468   //
 469   // However, to prevent the proliferation of improperly built native
 470   // libraries, the new path component /usr/java/packages is added here.
 471   // Eventually, all the library path setting will be done here.
 472   {
 473     // Get the user setting of LD_LIBRARY_PATH, and prepended it. It
 474     // should always exist (until the legacy problem cited above is
 475     // addressed).
 476     const char *v = ::getenv("LD_LIBRARY_PATH");
 477     const char *v_colon = ":";
 478     if (v == NULL) { v = ""; v_colon = ""; }
 479     // That's +1 for the colon and +1 for the trailing '\0'.
 480     char *ld_library_path = NEW_C_HEAP_ARRAY(char,
 481                                              strlen(v) + 1 +
 482                                              sizeof(SYS_EXT_DIR) + sizeof("/lib/") + sizeof(DEFAULT_LIBPATH) + 1,
 483                                              mtInternal);
 484     sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib:" DEFAULT_LIBPATH, v, v_colon);
 485     Arguments::set_library_path(ld_library_path);
 486     FREE_C_HEAP_ARRAY(char, ld_library_path);
 487   }
 488 
 489   // Extensions directories.
 490   sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
 491   Arguments::set_ext_dirs(buf);
 492 
 493   FREE_C_HEAP_ARRAY(char, buf);
 494 
 495 #undef DEFAULT_LIBPATH
 496 #undef SYS_EXT_DIR
 497 #undef EXTENSIONS_DIR
 498 }
 499 
 500 ////////////////////////////////////////////////////////////////////////////////
 501 // breakpoint support
 502 
 503 void os::breakpoint() {
< prev index next >