1760 time_t long_time; 1761 time(&long_time); 1762 localtime_r(&long_time, &t); 1763 jio_snprintf(buf, buflen, "%d-%02d-%02d %02d:%02d:%02d", 1764 t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, 1765 t.tm_hour, t.tm_min, t.tm_sec); 1766 return buf; 1767 } 1768 1769 // Note: os::shutdown() might be called very early during initialization, or 1770 // called from signal handler. Before adding something to os::shutdown(), make 1771 // sure it is async-safe and can handle partially initialized VM. 1772 void os::shutdown() { 1773 1774 // allow PerfMemory to attempt cleanup of any persistent resources 1775 perfMemory_exit(); 1776 1777 // needs to remove object in file system 1778 AttachListener::abort(); 1779 1780 // flush buffered output, finish log files 1781 ostream_abort(); 1782 1783 // Check for abort hook 1784 abort_hook_t abort_hook = Arguments::abort_hook(); 1785 if (abort_hook != NULL) { 1786 abort_hook(); 1787 } 1788 } 1789 1790 // Note: os::abort() might be called very early during initialization, or 1791 // called from signal handler. Before adding something to os::abort(), make 1792 // sure it is async-safe and can handle partially initialized VM. 1793 void os::abort(bool dump_core) { 1794 os::shutdown(); 1795 if (dump_core) { 1796 #ifndef PRODUCT 1797 fdStream out(defaultStream::output_fd()); 1798 out.print_raw("Current thread is "); 1799 char buf[16]; 1800 jio_snprintf(buf, sizeof(buf), UINTX_FORMAT, os::current_thread_id()); 1801 out.print_raw_cr(buf); 1802 out.print_raw_cr("Dumping core ..."); | 1760 time_t long_time; 1761 time(&long_time); 1762 localtime_r(&long_time, &t); 1763 jio_snprintf(buf, buflen, "%d-%02d-%02d %02d:%02d:%02d", 1764 t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, 1765 t.tm_hour, t.tm_min, t.tm_sec); 1766 return buf; 1767 } 1768 1769 // Note: os::shutdown() might be called very early during initialization, or 1770 // called from signal handler. Before adding something to os::shutdown(), make 1771 // sure it is async-safe and can handle partially initialized VM. 1772 void os::shutdown() { 1773 1774 // allow PerfMemory to attempt cleanup of any persistent resources 1775 perfMemory_exit(); 1776 1777 // needs to remove object in file system 1778 AttachListener::abort(); 1779 1780 // Check for abort hook 1781 abort_hook_t abort_hook = Arguments::abort_hook(); 1782 if (abort_hook != NULL) { 1783 abort_hook(); 1784 } 1785 } 1786 1787 // Note: os::abort() might be called very early during initialization, or 1788 // called from signal handler. Before adding something to os::abort(), make 1789 // sure it is async-safe and can handle partially initialized VM. 1790 void os::abort(bool dump_core) { 1791 os::shutdown(); 1792 if (dump_core) { 1793 #ifndef PRODUCT 1794 fdStream out(defaultStream::output_fd()); 1795 out.print_raw("Current thread is "); 1796 char buf[16]; 1797 jio_snprintf(buf, sizeof(buf), UINTX_FORMAT, os::current_thread_id()); 1798 out.print_raw_cr(buf); 1799 out.print_raw_cr("Dumping core ..."); |