Verified Commit 51f0ef28 authored by jD91mZM2's avatar jD91mZM2

Implement Deref for PtraceFlags

parent a0581db1
use bitflags::bitflags as inner_bitflags;
use core::{mem, ops::Deref, slice};
macro_rules! bitflags {
(
......@@ -132,6 +133,18 @@ bitflags! {
const PTRACE_FLAG_MASK = 0x0000_0000_0000_F000;
}
}
impl Deref for PtraceFlags {
type Target = [u8];
fn deref(&self) -> &Self::Target {
// Same as to_ne_bytes but in-place
unsafe {
slice::from_raw_parts(
&self.bits as *const _ as *const u8,
mem::size_of::<u64>()
)
}
}
}
pub const SEEK_SET: usize = 0;
pub const SEEK_CUR: usize = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment