Fixed ucontext & libc
This commit is contained in:
parent
8c6ef4e131
commit
8889d43f9d
@ -11,7 +11,7 @@ use std::mem::MaybeUninit;
|
||||
#[derive(PartialEq)]
|
||||
pub struct UContextT {
|
||||
#[cfg(not(target_os = "windows"))] // struct non disponible sur la libc sur windows
|
||||
pub buf: lib::ucontext_t,
|
||||
pub buf: libc::ucontext_t,
|
||||
pub stackBottom: Vec<i8>
|
||||
}
|
||||
|
||||
@ -19,8 +19,8 @@ pub struct UContextT {
|
||||
impl UContextT {
|
||||
|
||||
pub fn new() -> Self {
|
||||
let mut context = MaybeUninit::<ucontext_t>::uninit();
|
||||
unsafe { lib::getcontext(context.as_mut_ptr()) };
|
||||
let mut context = MaybeUninit::<libc::ucontext_t>::uninit();
|
||||
unsafe { libc::getcontext(context.as_mut_ptr()) };
|
||||
Self {
|
||||
buf: unsafe { context.assume_init() },
|
||||
stackBottom: Vec::default(),
|
||||
@ -32,7 +32,7 @@ impl UContextT {
|
||||
/// Use `man getcontext` for more informations
|
||||
pub fn get_context(&mut self) -> i32 {
|
||||
unsafe {
|
||||
lib::getcontext(&mut self.buf)
|
||||
libc::getcontext(&mut self.buf)
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,13 +41,13 @@ impl UContextT {
|
||||
/// Use `man setcontext` for more informations
|
||||
pub fn set_context(&mut self) -> i32 {
|
||||
unsafe {
|
||||
lib::setcontext(&self.buf)
|
||||
libc::setcontext(&self.buf)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn make_context(&mut self, func: extern "C" fn(), args: i32) {
|
||||
unsafe {
|
||||
lib::makecontext(&mut self.buf, func, args)
|
||||
libc::makecontext(&mut self.buf, func, args)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user