Skip to content
This repository was archived by the owner on Mar 7, 2021. It is now read-only.

Update for new oom handler API #61

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/allocator.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::alloc::{AllocErr, GlobalAlloc, Layout};
use core::alloc::{GlobalAlloc, Layout};

use bindings;
use c_types;
Expand All @@ -21,7 +21,7 @@ unsafe impl GlobalAlloc for KernelAllocator {
}
}

#[lang = "oom"]
extern "C" fn oom(_err: AllocErr) -> ! {
#[alloc_error_handler]
fn oom(_layout: Layout) -> ! {
panic!("Out of memory!");
}
8 changes: 7 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#![no_std]
#![feature(alloc, allocator_api, const_fn, lang_items, panic_implementation)]
#![feature(
alloc,
allocator_api,
alloc_error_handler,
const_fn,
panic_implementation
)]

#[macro_use]
extern crate alloc;
Expand Down
4 changes: 2 additions & 2 deletions src/sysctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl SysctlStorage for atomic::AtomicBool {

pub struct Sysctl<T: SysctlStorage> {
inner: Box<T>,
table: Box<[bindings::ctl_table]>,
_table: Box<[bindings::ctl_table]>,
header: *mut bindings::ctl_table_header,
}

Expand Down Expand Up @@ -137,7 +137,7 @@ impl<T: SysctlStorage> Sysctl<T> {

return Ok(Sysctl {
inner: storage,
table: table,
_table: table,
header: result,
});
}
Expand Down