hotspot/src/os/bsd/vm/os_bsd.cpp
changeset 27562 47f369e3c69c
parent 27474 2b061fd571eb
child 27926 0e2e188ab887
equal deleted inserted replaced
27561:7ead528de130 27562:47f369e3c69c
   351 #endif
   351 #endif
   352 
   352 
   353 // Base path of extensions installed on the system.
   353 // Base path of extensions installed on the system.
   354 #define SYS_EXT_DIR     "/usr/java/packages"
   354 #define SYS_EXT_DIR     "/usr/java/packages"
   355 #define EXTENSIONS_DIR  "/lib/ext"
   355 #define EXTENSIONS_DIR  "/lib/ext"
   356 #define ENDORSED_DIR    "/lib/endorsed"
       
   357 
   356 
   358 #ifndef __APPLE__
   357 #ifndef __APPLE__
   359 
   358 
   360   // Buffer that fits several sprintfs.
   359   // Buffer that fits several sprintfs.
   361   // Note that the space for the colon and the trailing null are provided
   360   // Note that the space for the colon and the trailing null are provided
   362   // by the nulls included by the sizeof operator.
   361   // by the nulls included by the sizeof operator.
   363   const size_t bufsize =
   362   const size_t bufsize =
   364     MAX3((size_t)MAXPATHLEN,  // For dll_dir & friends.
   363     MAX2((size_t)MAXPATHLEN,  // For dll_dir & friends.
   365          (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
   364          (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
   366          (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
       
   367   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
   365   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
   368 
   366 
   369   // sysclasspath, java_home, dll_dir
   367   // sysclasspath, java_home, dll_dir
   370   {
   368   {
   371     char *pslash;
   369     char *pslash;
   423 
   421 
   424   // Extensions directories.
   422   // Extensions directories.
   425   sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
   423   sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
   426   Arguments::set_ext_dirs(buf);
   424   Arguments::set_ext_dirs(buf);
   427 
   425 
   428   // Endorsed standards default directory.
       
   429   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
       
   430   Arguments::set_endorsed_dirs(buf);
       
   431 
       
   432   FREE_C_HEAP_ARRAY(char, buf, mtInternal);
   426   FREE_C_HEAP_ARRAY(char, buf, mtInternal);
   433 
   427 
   434 #else // __APPLE__
   428 #else // __APPLE__
   435 
   429 
   436   #define SYS_EXTENSIONS_DIR   "/Library/Java/Extensions"
   430   #define SYS_EXTENSIONS_DIR   "/Library/Java/Extensions"
   443 
   437 
   444   // Buffer that fits several sprintfs.
   438   // Buffer that fits several sprintfs.
   445   // Note that the space for the colon and the trailing null are provided
   439   // Note that the space for the colon and the trailing null are provided
   446   // by the nulls included by the sizeof operator.
   440   // by the nulls included by the sizeof operator.
   447   const size_t bufsize =
   441   const size_t bufsize =
   448     MAX3((size_t)MAXPATHLEN,  // for dll_dir & friends.
   442     MAX2((size_t)MAXPATHLEN,  // for dll_dir & friends.
   449          (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size, // extensions dir
   443          (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size); // extensions dir
   450          (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
       
   451   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
   444   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
   452 
   445 
   453   // sysclasspath, java_home, dll_dir
   446   // sysclasspath, java_home, dll_dir
   454   {
   447   {
   455     char *pslash;
   448     char *pslash;
   523   // than necessary is allocated).
   516   // than necessary is allocated).
   524   sprintf(buf, "%s" SYS_EXTENSIONS_DIR ":%s" EXTENSIONS_DIR ":" SYS_EXTENSIONS_DIRS,
   517   sprintf(buf, "%s" SYS_EXTENSIONS_DIR ":%s" EXTENSIONS_DIR ":" SYS_EXTENSIONS_DIRS,
   525           user_home_dir, Arguments::get_java_home());
   518           user_home_dir, Arguments::get_java_home());
   526   Arguments::set_ext_dirs(buf);
   519   Arguments::set_ext_dirs(buf);
   527 
   520 
   528   // Endorsed standards default directory.
       
   529   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
       
   530   Arguments::set_endorsed_dirs(buf);
       
   531 
       
   532   FREE_C_HEAP_ARRAY(char, buf, mtInternal);
   521   FREE_C_HEAP_ARRAY(char, buf, mtInternal);
   533 
   522 
   534 #undef SYS_EXTENSIONS_DIR
   523 #undef SYS_EXTENSIONS_DIR
   535 #undef SYS_EXTENSIONS_DIRS
   524 #undef SYS_EXTENSIONS_DIRS
   536 
   525 
   537 #endif // __APPLE__
   526 #endif // __APPLE__
   538 
   527 
   539 #undef SYS_EXT_DIR
   528 #undef SYS_EXT_DIR
   540 #undef EXTENSIONS_DIR
   529 #undef EXTENSIONS_DIR
   541 #undef ENDORSED_DIR
       
   542 }
   530 }
   543 
   531 
   544 ////////////////////////////////////////////////////////////////////////////////
   532 ////////////////////////////////////////////////////////////////////////////////
   545 // breakpoint support
   533 // breakpoint support
   546 
   534 
  2572   }
  2560   }
  2573 }
  2561 }
  2574 
  2562 
  2575 size_t os::read(int fd, void *buf, unsigned int nBytes) {
  2563 size_t os::read(int fd, void *buf, unsigned int nBytes) {
  2576   RESTARTABLE_RETURN_INT(::read(fd, buf, nBytes));
  2564   RESTARTABLE_RETURN_INT(::read(fd, buf, nBytes));
       
  2565 }
       
  2566 
       
  2567 size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
       
  2568   RESTARTABLE_RETURN_INT(::pread(fd, buf, nBytes, offset));
  2577 }
  2569 }
  2578 
  2570 
  2579 void os::naked_short_sleep(jlong ms) {
  2571 void os::naked_short_sleep(jlong ms) {
  2580   struct timespec req;
  2572   struct timespec req;
  2581 
  2573