hotspot/src/os/windows/vm/os_windows.cpp
changeset 30125 8ba6e8e367e9
parent 28737 ca4b6a6e5cc8
child 30143 7e99f2b4bae5
equal deleted inserted replaced
30124:767dff18852c 30125:8ba6e8e367e9
   151   return result;
   151   return result;
   152 }
   152 }
   153 
   153 
   154 // Implementation of os
   154 // Implementation of os
   155 
   155 
   156 bool os::getenv(const char* name, char* buffer, int len) {
       
   157   int result = GetEnvironmentVariable(name, buffer, len);
       
   158   return result > 0 && result < len;
       
   159 }
       
   160 
       
   161 bool os::unsetenv(const char* name) {
   156 bool os::unsetenv(const char* name) {
   162   assert(name != NULL, "Null pointer");
   157   assert(name != NULL, "Null pointer");
   163   return (SetEnvironmentVariable(name, NULL) == TRUE);
   158   return (SetEnvironmentVariable(name, NULL) == TRUE);
   164 }
   159 }
   165 
   160 
   186   {
   181   {
   187     char *home_path;
   182     char *home_path;
   188     char *dll_path;
   183     char *dll_path;
   189     char *pslash;
   184     char *pslash;
   190     char *bin = "\\bin";
   185     char *bin = "\\bin";
   191     char home_dir[MAX_PATH];
   186     char home_dir[MAX_PATH + 1];
   192 
   187     char *alt_home_dir = ::getenv("_ALT_JAVA_HOME_DIR");
   193     if (!getenv("_ALT_JAVA_HOME_DIR", home_dir, MAX_PATH)) {
   188 
       
   189     if (alt_home_dir != NULL)  {
       
   190       strncpy(home_dir, alt_home_dir, MAX_PATH + 1);
       
   191       home_dir[MAX_PATH] = '\0';
       
   192     } else {
   194       os::jvm_path(home_dir, sizeof(home_dir));
   193       os::jvm_path(home_dir, sizeof(home_dir));
   195       // Found the full path to jvm.dll.
   194       // Found the full path to jvm.dll.
   196       // Now cut the path to <java_home>/jre if we can.
   195       // Now cut the path to <java_home>/jre if we can.
   197       *(strrchr(home_dir, '\\')) = '\0';  // get rid of \jvm.dll
   196       *(strrchr(home_dir, '\\')) = '\0';  // get rid of \jvm.dll
   198       pslash = strrchr(home_dir, '\\');
   197       pslash = strrchr(home_dir, '\\');
  5928   // restore globals
  5927   // restore globals
  5929   UseLargePagesIndividualAllocation = old_use_large_pages_individual_allocation;
  5928   UseLargePagesIndividualAllocation = old_use_large_pages_individual_allocation;
  5930   UseNUMAInterleaving = old_use_numa_interleaving;
  5929   UseNUMAInterleaving = old_use_numa_interleaving;
  5931 }
  5930 }
  5932 #endif // PRODUCT
  5931 #endif // PRODUCT
  5933