mirror of
https://github.com/urbit/ares.git
synced 2024-11-26 09:57:56 +03:00
Merge branch 'as/serf-guard' into msl/guard
This commit is contained in:
commit
6479459204
@ -7,7 +7,6 @@ use std::marker::PhantomData;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum GuardError {
|
||||
InvalidSignal,
|
||||
MemoryProtection,
|
||||
NullPointer,
|
||||
OutOfMemory,
|
||||
@ -19,7 +18,6 @@ impl From<u32> for GuardError {
|
||||
fn from(value: u32) -> Self {
|
||||
match value {
|
||||
GUARD_NULL => Self::NullPointer,
|
||||
GUARD_SIGNAL => Self::InvalidSignal,
|
||||
GUARD_OOM => Self::OutOfMemory,
|
||||
x if (x & GUARD_MPROTECT) != 0 => Self::MemoryProtection,
|
||||
x if (x & (GUARD_MALLOC | GUARD_SIGACTION)) != 0 => Self::Setup,
|
||||
@ -91,7 +89,7 @@ pub fn call_with_guard<F: FnMut() -> Result>(
|
||||
match err {
|
||||
GuardError::OutOfMemory => Err(Error::NonDeterministic(Mote::Meme, D(0))),
|
||||
_ => {
|
||||
panic!("serf: guard: unexpected error {:?}", err);
|
||||
panic!("serf: guard: unexpected error {:?} {}", err, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ _focus_guard()
|
||||
fprintf(stderr, "guard: focus: stack or alloc pointer is null\r\n");
|
||||
return guard_null;
|
||||
} else if (stack_p == alloc_p) {
|
||||
fprintf(stderr, "guard: focus: stack and alloc pointers equal\r\n");
|
||||
return guard_oom;
|
||||
}
|
||||
|
||||
|
@ -4,9 +4,10 @@
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
|
||||
pub const GUARD_NULL: u32 = guard_result_guard_null;
|
||||
pub const GUARD_SIGNAL: u32 = guard_result_guard_signal;
|
||||
pub const GUARD_OOM: u32 = guard_result_guard_oom;
|
||||
pub const GUARD_MALLOC: u32 = guard_result_guard_malloc;
|
||||
pub const GUARD_MPROTECT: u32 = guard_result_guard_mprotect;
|
||||
pub const GUARD_SIGACTION: u32 = guard_result_guard_sigaction;
|
||||
pub const GUARD_SUCCESS: u32 = guard_result_guard_success;
|
||||
pub const GUARD_NULL: u32 = guard_result_guard_null;
|
||||
pub const GUARD_SIGNAL: u32 = guard_result_guard_signal;
|
||||
pub const GUARD_OOM: u32 = guard_result_guard_oom;
|
||||
pub const GUARD_MALLOC: u32 = guard_result_guard_malloc;
|
||||
pub const GUARD_MPROTECT: u32 = guard_result_guard_mprotect;
|
||||
pub const GUARD_SIGACTION: u32 = guard_result_guard_sigaction;
|
||||
|
Loading…
Reference in New Issue
Block a user