1402 if (dump_core) { 1403 #ifndef PRODUCT 1404 fdStream out(defaultStream::output_fd()); 1405 out.print_raw("Current thread is "); 1406 char buf[16]; 1407 jio_snprintf(buf, sizeof(buf), UINTX_FORMAT, os::current_thread_id()); 1408 out.print_raw_cr(buf); 1409 out.print_raw_cr("Dumping core ..."); 1410 #endif 1411 ::abort(); // dump core 1412 } 1413 1414 ::exit(1); 1415 } 1416 1417 // Die immediately, no exit hook, no abort hook, no cleanup. 1418 void os::die() { 1419 ::abort(); 1420 } 1421 1422 1423 // This method is a copy of JDK's sysGetLastErrorString 1424 // from src/solaris/hpi/src/system_md.c 1425 1426 size_t os::lasterror(char *buf, size_t len) { 1427 if (errno == 0) return 0; 1428 1429 const char *s = os::strerror(errno); 1430 size_t n = ::strlen(s); 1431 if (n >= len) { 1432 n = len - 1; 1433 } 1434 ::strncpy(buf, s, n); 1435 buf[n] = '\0'; 1436 return n; 1437 } 1438 1439 // thread_id is kernel thread id (similar to Solaris LWP id) 1440 intx os::current_thread_id() { return os::Linux::gettid(); } 1441 int os::current_process_id() { 1442 return ::getpid(); 1443 } 1444 1445 // DLL functions 1446 1447 const char* os::dll_file_extension() { return ".so"; } 1448 1449 // This must be hard coded because it's the system's temporary 1450 // directory not the java application's temp directory, ala java.io.tmpdir. 1451 const char* os::get_temp_directory() { return "/tmp"; } 1452 1453 static bool file_exists(const char* filename) { 1454 struct stat statbuf; 1455 if (filename == NULL || strlen(filename) == 0) { 1456 return false; 1457 } 1458 return os::stat(filename, &statbuf) == 0; | 1402 if (dump_core) { 1403 #ifndef PRODUCT 1404 fdStream out(defaultStream::output_fd()); 1405 out.print_raw("Current thread is "); 1406 char buf[16]; 1407 jio_snprintf(buf, sizeof(buf), UINTX_FORMAT, os::current_thread_id()); 1408 out.print_raw_cr(buf); 1409 out.print_raw_cr("Dumping core ..."); 1410 #endif 1411 ::abort(); // dump core 1412 } 1413 1414 ::exit(1); 1415 } 1416 1417 // Die immediately, no exit hook, no abort hook, no cleanup. 1418 void os::die() { 1419 ::abort(); 1420 } 1421 1422 // thread_id is kernel thread id (similar to Solaris LWP id) 1423 intx os::current_thread_id() { return os::Linux::gettid(); } 1424 int os::current_process_id() { 1425 return ::getpid(); 1426 } 1427 1428 // DLL functions 1429 1430 const char* os::dll_file_extension() { return ".so"; } 1431 1432 // This must be hard coded because it's the system's temporary 1433 // directory not the java application's temp directory, ala java.io.tmpdir. 1434 const char* os::get_temp_directory() { return "/tmp"; } 1435 1436 static bool file_exists(const char* filename) { 1437 struct stat statbuf; 1438 if (filename == NULL || strlen(filename) == 0) { 1439 return false; 1440 } 1441 return os::stat(filename, &statbuf) == 0; |