hotspot/src/os/windows/vm/os_windows.cpp
changeset 27880 afb974a04396
parent 27873 60cce297ef8e
child 27926 0e2e188ab887
child 28014 3ca57ef4f132
equal deleted inserted replaced
27879:419385282044 27880:afb974a04396
   209     if (home_path == NULL) {
   209     if (home_path == NULL) {
   210       return;
   210       return;
   211     }
   211     }
   212     strcpy(home_path, home_dir);
   212     strcpy(home_path, home_dir);
   213     Arguments::set_java_home(home_path);
   213     Arguments::set_java_home(home_path);
   214     FREE_C_HEAP_ARRAY(char, home_path, mtInternal);
   214     FREE_C_HEAP_ARRAY(char, home_path);
   215 
   215 
   216     dll_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + strlen(bin) + 1,
   216     dll_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + strlen(bin) + 1,
   217                                 mtInternal);
   217                                 mtInternal);
   218     if (dll_path == NULL) {
   218     if (dll_path == NULL) {
   219       return;
   219       return;
   220     }
   220     }
   221     strcpy(dll_path, home_dir);
   221     strcpy(dll_path, home_dir);
   222     strcat(dll_path, bin);
   222     strcat(dll_path, bin);
   223     Arguments::set_dll_dir(dll_path);
   223     Arguments::set_dll_dir(dll_path);
   224     FREE_C_HEAP_ARRAY(char, dll_path, mtInternal);
   224     FREE_C_HEAP_ARRAY(char, dll_path);
   225 
   225 
   226     if (!set_boot_path('\\', ';')) {
   226     if (!set_boot_path('\\', ';')) {
   227       return;
   227       return;
   228     }
   228     }
   229   }
   229   }
   274     }
   274     }
   275 
   275 
   276     strcat(library_path, ";.");
   276     strcat(library_path, ";.");
   277 
   277 
   278     Arguments::set_library_path(library_path);
   278     Arguments::set_library_path(library_path);
   279     FREE_C_HEAP_ARRAY(char, library_path, mtInternal);
   279     FREE_C_HEAP_ARRAY(char, library_path);
   280   }
   280   }
   281 
   281 
   282   // Default extensions directory
   282   // Default extensions directory
   283   {
   283   {
   284     char path[MAX_PATH];
   284     char path[MAX_PATH];
   299     char * buf = NEW_C_HEAP_ARRAY(char, len, mtInternal);
   299     char * buf = NEW_C_HEAP_ARRAY(char, len, mtInternal);
   300     sprintf(buf, "%s%s", Arguments::get_java_home(), ENDORSED_DIR);
   300     sprintf(buf, "%s%s", Arguments::get_java_home(), ENDORSED_DIR);
   301     Arguments::set_endorsed_dirs(buf);
   301     Arguments::set_endorsed_dirs(buf);
   302     // (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which
   302     // (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which
   303     //  duplicates the input.)
   303     //  duplicates the input.)
   304     FREE_C_HEAP_ARRAY(char, buf, mtInternal);
   304     FREE_C_HEAP_ARRAY(char, buf);
   305 #undef ENDORSED_DIR
   305 #undef ENDORSED_DIR
   306   }
   306   }
   307 
   307 
   308 #ifndef _WIN64
   308 #ifndef _WIN64
   309   // set our UnhandledExceptionFilter and save any previous one
   309   // set our UnhandledExceptionFilter and save any previous one
  1134     dirname = alt_dirname;
  1134     dirname = alt_dirname;
  1135   }
  1135   }
  1136 
  1136 
  1137   dirp->path = (char *)malloc(strlen(dirname) + 5, mtInternal);
  1137   dirp->path = (char *)malloc(strlen(dirname) + 5, mtInternal);
  1138   if (dirp->path == 0) {
  1138   if (dirp->path == 0) {
  1139     free(dirp, mtInternal);
  1139     free(dirp);
  1140     errno = ENOMEM;
  1140     errno = ENOMEM;
  1141     return 0;
  1141     return 0;
  1142   }
  1142   }
  1143   strcpy(dirp->path, dirname);
  1143   strcpy(dirp->path, dirname);
  1144 
  1144 
  1145   fattr = GetFileAttributes(dirp->path);
  1145   fattr = GetFileAttributes(dirp->path);
  1146   if (fattr == 0xffffffff) {
  1146   if (fattr == 0xffffffff) {
  1147     free(dirp->path, mtInternal);
  1147     free(dirp->path);
  1148     free(dirp, mtInternal);
  1148     free(dirp);
  1149     errno = ENOENT;
  1149     errno = ENOENT;
  1150     return 0;
  1150     return 0;
  1151   } else if ((fattr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
  1151   } else if ((fattr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
  1152     free(dirp->path, mtInternal);
  1152     free(dirp->path);
  1153     free(dirp, mtInternal);
  1153     free(dirp);
  1154     errno = ENOTDIR;
  1154     errno = ENOTDIR;
  1155     return 0;
  1155     return 0;
  1156   }
  1156   }
  1157 
  1157 
  1158   // Append "*.*", or possibly "\\*.*", to path
  1158   // Append "*.*", or possibly "\\*.*", to path
  1166   }
  1166   }
  1167 
  1167 
  1168   dirp->handle = FindFirstFile(dirp->path, &dirp->find_data);
  1168   dirp->handle = FindFirstFile(dirp->path, &dirp->find_data);
  1169   if (dirp->handle == INVALID_HANDLE_VALUE) {
  1169   if (dirp->handle == INVALID_HANDLE_VALUE) {
  1170     if (GetLastError() != ERROR_FILE_NOT_FOUND) {
  1170     if (GetLastError() != ERROR_FILE_NOT_FOUND) {
  1171       free(dirp->path, mtInternal);
  1171       free(dirp->path);
  1172       free(dirp, mtInternal);
  1172       free(dirp);
  1173       errno = EACCES;
  1173       errno = EACCES;
  1174       return 0;
  1174       return 0;
  1175     }
  1175     }
  1176   }
  1176   }
  1177   return dirp;
  1177   return dirp;
  1205       errno = EBADF;
  1205       errno = EBADF;
  1206       return -1;
  1206       return -1;
  1207     }
  1207     }
  1208     dirp->handle = INVALID_HANDLE_VALUE;
  1208     dirp->handle = INVALID_HANDLE_VALUE;
  1209   }
  1209   }
  1210   free(dirp->path, mtInternal);
  1210   free(dirp->path);
  1211   free(dirp, mtInternal);
  1211   free(dirp);
  1212   return 0;
  1212   return 0;
  1213 }
  1213 }
  1214 
  1214 
  1215 // This must be hard coded because it's the system's temporary
  1215 // This must be hard coded because it's the system's temporary
  1216 // directory not the java application's temp directory, ala java.io.tmpdir.
  1216 // directory not the java application's temp directory, ala java.io.tmpdir.
  1273       }
  1273       }
  1274     }
  1274     }
  1275     // release the storage
  1275     // release the storage
  1276     for (int i = 0; i < n; i++) {
  1276     for (int i = 0; i < n; i++) {
  1277       if (pelements[i] != NULL) {
  1277       if (pelements[i] != NULL) {
  1278         FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
  1278         FREE_C_HEAP_ARRAY(char, pelements[i]);
  1279       }
  1279       }
  1280     }
  1280     }
  1281     if (pelements != NULL) {
  1281     if (pelements != NULL) {
  1282       FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
  1282       FREE_C_HEAP_ARRAY(char*, pelements);
  1283     }
  1283     }
  1284   } else {
  1284   } else {
  1285     jio_snprintf(buffer, buflen, "%s\\%s.dll", pname, fname);
  1285     jio_snprintf(buffer, buflen, "%s\\%s.dll", pname, fname);
  1286     retval = true;
  1286     retval = true;
  1287   }
  1287   }
  2743   int *_numa_used_node_list;  // allocated below
  2743   int *_numa_used_node_list;  // allocated below
  2744   int _numa_used_node_count;
  2744   int _numa_used_node_count;
  2745 
  2745 
  2746   void free_node_list() {
  2746   void free_node_list() {
  2747     if (_numa_used_node_list != NULL) {
  2747     if (_numa_used_node_list != NULL) {
  2748       FREE_C_HEAP_ARRAY(int, _numa_used_node_list, mtInternal);
  2748       FREE_C_HEAP_ARRAY(int, _numa_used_node_list);
  2749     }
  2749     }
  2750   }
  2750   }
  2751 
  2751 
  2752  public:
  2752  public:
  2753   NUMANodeListHolder() {
  2753   NUMANodeListHolder() {
  4640     return FALSE;
  4640     return FALSE;
  4641   }
  4641   }
  4642 
  4642 
  4643   error = ::PeekConsoleInput(han, lpBuffer, numEvents, &numEventsRead);
  4643   error = ::PeekConsoleInput(han, lpBuffer, numEvents, &numEventsRead);
  4644   if (error == 0) {
  4644   if (error == 0) {
  4645     os::free(lpBuffer, mtInternal);
  4645     os::free(lpBuffer);
  4646     return FALSE;
  4646     return FALSE;
  4647   }
  4647   }
  4648 
  4648 
  4649   // Examine input records for the number of bytes available
  4649   // Examine input records for the number of bytes available
  4650   for (i=0; i<numEvents; i++) {
  4650   for (i=0; i<numEvents; i++) {
  4661       }
  4661       }
  4662     }
  4662     }
  4663   }
  4663   }
  4664 
  4664 
  4665   if (lpBuffer != NULL) {
  4665   if (lpBuffer != NULL) {
  4666     os::free(lpBuffer, mtInternal);
  4666     os::free(lpBuffer);
  4667   }
  4667   }
  4668 
  4668 
  4669   *pbytes = (long) actualLength;
  4669   *pbytes = (long) actualLength;
  4670   return TRUE;
  4670   return TRUE;
  4671 }
  4671 }