Skip to content

Remove obsolete oom handler from sys::redox #43203

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Jul 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions src/libstd/sys/redox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,7 @@ pub mod thread_local;
pub mod time;

#[cfg(not(test))]
pub fn init() {
use alloc::oom;

oom::set_oom_handler(oom_handler);

// A nicer handler for out-of-memory situations than the default one. This
// one prints a message to stderr before aborting. It is critical that this
// code does not allocate any memory since we are in an OOM situation. Any
// errors are ignored while printing since there's nothing we can do about
// them and we are about to exit anyways.
fn oom_handler() -> ! {
use intrinsics;
let msg = "fatal runtime error: out of memory\n";
unsafe {
let _ = syscall::write(2, msg.as_bytes());
intrinsics::abort();
}
}
}
pub fn init() {}

pub fn decode_error_kind(errno: i32) -> ErrorKind {
match errno {
Expand Down