1
Fork 0

std: Internalize almost all of std::rt

This commit does some refactoring to make almost all of the `std::rt` private.
Specifically, the following items are no longer part of its API:

* DEFAULT_ERROR_CODE
* backtrace
* unwind
* args
* at_exit
* cleanup
* heap (this is just alloc::heap)
* min_stack
* util

The module is now tagged as `#[doc(hidden)]` as the only purpose it's serve is
an entry point for the `panic!` macro via the `begin_unwind` and
`begin_unwind_fmt` reexports.
This commit is contained in:
Alex Crichton 2015-09-08 15:53:46 -07:00
parent 192c37537b
commit f4be2026df
33 changed files with 273 additions and 432 deletions

View file

@ -12,6 +12,7 @@
#![allow(non_camel_case_types)]
use io::{self, ErrorKind};
use libc::funcs::posix01::signal::signal;
use libc;
use num::One;
use ops::Neg;
@ -47,6 +48,19 @@ pub mod thread_local;
pub mod time;
pub mod stdio;
pub fn init() {
// By default, some platforms will send a *signal* when a EPIPE error
// would otherwise be delivered. This runtime doesn't install a SIGPIPE
// handler, causing it to kill the program, which isn't exactly what we
// want!
//
// Hence, we set SIGPIPE to ignore when the program starts up in order
// to prevent this problem.
unsafe {
assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != !0);
}
}
pub fn decode_error_kind(errno: i32) -> ErrorKind {
match errno as libc::c_int {
libc::ECONNREFUSED => ErrorKind::ConnectionRefused,