275 276 strcat(library_path, ";."); 277 278 Arguments::set_library_path(library_path); 279 FREE_C_HEAP_ARRAY(char, library_path, mtInternal); 280 } 281 282 // Default extensions directory 283 { 284 char path[MAX_PATH]; 285 char buf[2 * MAX_PATH + 2 * sizeof(EXT_DIR) + sizeof(PACKAGE_DIR) + 1]; 286 GetWindowsDirectory(path, MAX_PATH); 287 sprintf(buf, "%s%s;%s%s%s", Arguments::get_java_home(), EXT_DIR, 288 path, PACKAGE_DIR, EXT_DIR); 289 Arguments::set_ext_dirs(buf); 290 } 291 #undef EXT_DIR 292 #undef BIN_DIR 293 #undef PACKAGE_DIR 294 295 // Default endorsed standards directory. 296 { 297 #define ENDORSED_DIR "\\lib\\endorsed" 298 size_t len = strlen(Arguments::get_java_home()) + sizeof(ENDORSED_DIR); 299 char * buf = NEW_C_HEAP_ARRAY(char, len, mtInternal); 300 sprintf(buf, "%s%s", Arguments::get_java_home(), ENDORSED_DIR); 301 Arguments::set_endorsed_dirs(buf); 302 // (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which 303 // duplicates the input.) 304 FREE_C_HEAP_ARRAY(char, buf, mtInternal); 305 #undef ENDORSED_DIR 306 } 307 308 #ifndef _WIN64 309 // set our UnhandledExceptionFilter and save any previous one 310 prev_uef_handler = SetUnhandledExceptionFilter(Handle_FLT_Exception); 311 #endif 312 313 // Done 314 return; 315 } 316 317 void os::breakpoint() { 318 DebugBreak(); 319 } 320 321 // Invoked from the BREAKPOINT Macro 322 extern "C" void breakpoint() { 323 os::breakpoint(); 324 } 325 326 // RtlCaptureStackBackTrace Windows API may not exist prior to Windows XP. 327 // So far, this method is only used by Native Memory Tracking, which is 4359 oflags |= _O_EXCL; 4360 } 4361 return ::open(path, oflags, _S_IREAD | _S_IWRITE); 4362 } 4363 4364 // return current position of file pointer 4365 jlong os::current_file_offset(int fd) { 4366 return (jlong)::_lseeki64(fd, (__int64)0L, SEEK_CUR); 4367 } 4368 4369 // move file pointer to the specified offset 4370 jlong os::seek_to_file_offset(int fd, jlong offset) { 4371 return (jlong)::_lseeki64(fd, (__int64)offset, SEEK_SET); 4372 } 4373 4374 4375 jlong os::lseek(int fd, jlong offset, int whence) { 4376 return (jlong) ::_lseeki64(fd, offset, whence); 4377 } 4378 4379 // This method is a slightly reworked copy of JDK's sysNativePath 4380 // from src/windows/hpi/src/path_md.c 4381 4382 // Convert a pathname to native format. On win32, this involves forcing all 4383 // separators to be '\\' rather than '/' (both are legal inputs, but Win95 4384 // sometimes rejects '/') and removing redundant separators. The input path is 4385 // assumed to have been converted into the character encoding used by the local 4386 // system. Because this might be a double-byte encoding, care is taken to 4387 // treat double-byte lead characters correctly. 4388 // 4389 // This procedure modifies the given path in place, as the result is never 4390 // longer than the original. There is no error return; this operation always 4391 // succeeds. 4392 char * os::native_path(char *path) { 4393 char *src = path, *dst = path, *end = path; 4394 char *colon = NULL; // If a drive specifier is found, this will 4395 // point to the colon following the drive letter 4396 4397 // Assumption: '/', '\\', ':', and drive letters are never lead bytes 4398 assert(((!::IsDBCSLeadByte('/')) && (!::IsDBCSLeadByte('\\')) | 275 276 strcat(library_path, ";."); 277 278 Arguments::set_library_path(library_path); 279 FREE_C_HEAP_ARRAY(char, library_path, mtInternal); 280 } 281 282 // Default extensions directory 283 { 284 char path[MAX_PATH]; 285 char buf[2 * MAX_PATH + 2 * sizeof(EXT_DIR) + sizeof(PACKAGE_DIR) + 1]; 286 GetWindowsDirectory(path, MAX_PATH); 287 sprintf(buf, "%s%s;%s%s%s", Arguments::get_java_home(), EXT_DIR, 288 path, PACKAGE_DIR, EXT_DIR); 289 Arguments::set_ext_dirs(buf); 290 } 291 #undef EXT_DIR 292 #undef BIN_DIR 293 #undef PACKAGE_DIR 294 295 #ifndef _WIN64 296 // set our UnhandledExceptionFilter and save any previous one 297 prev_uef_handler = SetUnhandledExceptionFilter(Handle_FLT_Exception); 298 #endif 299 300 // Done 301 return; 302 } 303 304 void os::breakpoint() { 305 DebugBreak(); 306 } 307 308 // Invoked from the BREAKPOINT Macro 309 extern "C" void breakpoint() { 310 os::breakpoint(); 311 } 312 313 // RtlCaptureStackBackTrace Windows API may not exist prior to Windows XP. 314 // So far, this method is only used by Native Memory Tracking, which is 4346 oflags |= _O_EXCL; 4347 } 4348 return ::open(path, oflags, _S_IREAD | _S_IWRITE); 4349 } 4350 4351 // return current position of file pointer 4352 jlong os::current_file_offset(int fd) { 4353 return (jlong)::_lseeki64(fd, (__int64)0L, SEEK_CUR); 4354 } 4355 4356 // move file pointer to the specified offset 4357 jlong os::seek_to_file_offset(int fd, jlong offset) { 4358 return (jlong)::_lseeki64(fd, (__int64)offset, SEEK_SET); 4359 } 4360 4361 4362 jlong os::lseek(int fd, jlong offset, int whence) { 4363 return (jlong) ::_lseeki64(fd, offset, whence); 4364 } 4365 4366 size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) { 4367 OVERLAPPED ov; 4368 DWORD nread; 4369 BOOL result; 4370 4371 ZeroMemory(&ov, sizeof(ov)); 4372 ov.Offset = (DWORD)offset; 4373 ov.OffsetHigh = (DWORD)(offset >> 32); 4374 4375 HANDLE h = (HANDLE)::_get_osfhandle(fd); 4376 4377 result = ReadFile(h, (LPVOID)buf, nBytes, &nread, &ov); 4378 4379 return result ? nread : 0; 4380 } 4381 4382 4383 // This method is a slightly reworked copy of JDK's sysNativePath 4384 // from src/windows/hpi/src/path_md.c 4385 4386 // Convert a pathname to native format. On win32, this involves forcing all 4387 // separators to be '\\' rather than '/' (both are legal inputs, but Win95 4388 // sometimes rejects '/') and removing redundant separators. The input path is 4389 // assumed to have been converted into the character encoding used by the local 4390 // system. Because this might be a double-byte encoding, care is taken to 4391 // treat double-byte lead characters correctly. 4392 // 4393 // This procedure modifies the given path in place, as the result is never 4394 // longer than the original. There is no error return; this operation always 4395 // succeeds. 4396 char * os::native_path(char *path) { 4397 char *src = path, *dst = path, *end = path; 4398 char *colon = NULL; // If a drive specifier is found, this will 4399 // point to the colon following the drive letter 4400 4401 // Assumption: '/', '\\', ':', and drive letters are never lead bytes 4402 assert(((!::IsDBCSLeadByte('/')) && (!::IsDBCSLeadByte('\\')) |