Switch PalPtrace to Rusty error handling.

This commit is contained in:
4lDO2
2024-09-27 13:14:29 +02:00
parent d474163e0e
commit 070b4cd05c
4 changed files with 40 additions and 13 deletions
+9 -3
View File
@@ -1,10 +1,16 @@
use super::{
super::{types::*, PalPtrace},
e, Sys,
e_raw, Sys,
};
use crate::error::Result;
impl PalPtrace for Sys {
fn ptrace(request: c_int, pid: pid_t, addr: *mut c_void, data: *mut c_void) -> c_int {
unsafe { e(syscall!(PTRACE, request, pid, addr, data)) as c_int }
unsafe fn ptrace(
request: c_int,
pid: pid_t,
addr: *mut c_void,
data: *mut c_void,
) -> Result<c_int> {
Ok(unsafe { e_raw(syscall!(PTRACE, request, pid, addr, data))? as c_int })
}
}