From f3a709dc52bb3e617ccb016a8b20a741c23da77d Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 30 Sep 2016 23:07:04 +0000 Subject: std: Move platform-specific out of sys_common::util --- src/libstd/sys/unix/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/libstd/sys/unix') diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index 0e28426b32f..fd7dc17cccd 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -163,3 +163,14 @@ pub fn cvt_r(mut f: F) -> io::Result } } } + +// On Unix-like platforms, libc::abort will unregister signal handlers +// including the SIGABRT handler, preventing the abort from being blocked, and +// fclose streams, with the side effect of flushing them so libc bufferred +// output will be printed. Additionally the shell will generally print a more +// understandable error message like "Abort trap" rather than "Illegal +// instruction" that intrinsics::abort would cause, as intrinsics::abort is +// implemented as an illegal instruction. +pub unsafe fn abort_internal() -> ! { + ::libc::abort() +} -- cgit 1.4.1-3-g733a5