Add ThreadEvent, ContextStatus.

This commit is contained in:
4lDO2
2025-03-03 14:12:18 +01:00
parent 3afd6a2654
commit 9081c7f2b9
2 changed files with 50 additions and 0 deletions
+39
View File
@@ -231,6 +231,45 @@ impl DerefMut for TimeSpec {
}
}
/*
// ABI-UNSTABLE!
#[derive(Clone, Copy, Debug, Default)]
#[repr(C)]
pub struct ThreadEvent {
pub kind: u8,
pub _rsvd: [u8; size_of::<usize>() - 1],
pub payload: [usize; 3],
}
#[repr(u8)]
#[derive(Clone, Copy, Debug)]
pub enum ThreadEventKind {
Sigkill = 0,
}
impl Deref for ThreadEvent {
type Target = [u8];
fn deref(&self) -> &[u8] {
unsafe {
slice::from_raw_parts(
self as *const ThreadEvent as *const u8,
mem::size_of::<ThreadEvent>(),
)
}
}
}
impl DerefMut for ThreadEvent {
fn deref_mut(&mut self) -> &mut [u8] {
unsafe {
slice::from_raw_parts_mut(
self as *mut ThreadEvent as *mut u8,
mem::size_of::<ThreadEvent>(),
)
}
}
}
*/
#[derive(Clone, Copy, Debug, Default)]
#[repr(C)]
pub struct PtraceEvent {
+11
View File
@@ -170,6 +170,17 @@ pub const O_ACCMODE: usize = O_RDONLY | O_WRONLY | O_RDWR;
// The top 48 bits of PTRACE_* are reserved, for now
// NOT ABI STABLE!
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[repr(usize)]
pub enum ContextStatus {
Runnable,
Blocked,
NotYetStarted,
Dead,
Other, // reserved
}
bitflags! {
pub struct PtraceFlags: u64 {
/// Stop before a syscall is handled. Send PTRACE_FLAG_IGNORE to not