Commit 325b57d5 authored by Tommy Hudson's avatar Tommy Hudson

SendFd scheme support

parent 6909fb1c
......@@ -217,3 +217,29 @@ impl DerefMut for TimeSpec {
}
}
}
#[derive(Copy, Clone, Debug, Default)]
#[repr(C)]
pub struct ReceivedFd {
pub fd: usize,
pub from_pid: usize,
}
impl Deref for ReceivedFd {
type Target = [u8];
fn deref(&self) -> &[u8] {
unsafe {
slice::from_raw_parts(self as *const ReceivedFd as *const u8,
mem::size_of::<ReceivedFd>()) as &[u8]
}
}
}
impl DerefMut for ReceivedFd {
fn deref_mut(&mut self) -> &mut [u8] {
unsafe {
slice::from_raw_parts_mut(self as *mut ReceivedFd as *mut u8,
mem::size_of::<ReceivedFd>()) as &mut [u8]
}
}
}
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