MCPcopy Create free account
hub / github.com/Starry-OS/StarryOS / push

Method push

api/src/syscall/net/cmsg.rs:62–86  ·  view source on GitHub ↗
(
        &mut self,
        level: u32,
        ty: u32,
        body: impl FnOnce(&mut [u8]) -> AxResult<usize>,
    )

Source from the content-addressed store, hash-verified

60 }
61
62 pub fn push(
63 &mut self,
64 level: u32,
65 ty: u32,
66 body: impl FnOnce(&mut [u8]) -> AxResult<usize>,
67 ) -> AxResult<bool> {
68 let Some(body_capacity) = (self.capacity - *self.len).checked_sub(size_of::<cmsghdr>())
69 else {
70 return Ok(false);
71 };
72
73 let hdr = self.hdr.get_as_mut()?;
74 hdr.cmsg_level = level as _;
75 hdr.cmsg_type = ty as _;
76
77 let data = UserPtr::<u8>::from(self.hdr.address().as_usize() + size_of::<cmsghdr>())
78 .get_as_mut_slice(body_capacity)?;
79 let body_len = body(data)?;
80
81 let cmsg_len = size_of::<cmsghdr>() + body_len;
82 hdr.cmsg_len = cmsg_len;
83 self.hdr = UserPtr::from(hdr as *const _ as usize + cmsg_len);
84 *self.len += cmsg_len;
85 Ok(true)
86 }
87}

Callers 13

renew_timerMethod · 0.80
get_shmids_by_pidMethod · 0.80
write_to_userMethod · 0.80
pollMethod · 0.80
lookup_childMethod · 0.80
mount_allFunction · 0.80
run_memory_analysisFunction · 0.80
sys_sendmsgFunction · 0.80
recv_implFunction · 0.80
parseMethod · 0.80
do_selectFunction · 0.80
do_pollFunction · 0.80

Calls 4

get_as_mutMethod · 0.80
get_as_mut_sliceMethod · 0.80
as_usizeMethod · 0.80
addressMethod · 0.80

Tested by

no test coverage detected