MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / push

Method push

src/net/send_recv/msg.rs:299–321  ·  view source on GitHub ↗

Add an ancillary message to the buffer. Returns `true` if the message was added successfully.

(&mut self, msg: SendAncillaryMessage<'slice, 'fd>)

Source from the content-addressed store, hash-verified

297 ///
298 /// Returns `true` if the message was added successfully.
299 pub fn push(&mut self, msg: SendAncillaryMessage<'slice, 'fd>) -> bool {
300 match msg {
301 SendAncillaryMessage::ScmRights(fds) => {
302 let fds_bytes =
303 unsafe { slice::from_raw_parts(fds.as_ptr().cast::<u8>(), size_of_val(fds)) };
304 self.push_ancillary(fds_bytes, c::SOL_SOCKET as _, c::SCM_RIGHTS as _)
305 }
306 #[cfg(linux_kernel)]
307 SendAncillaryMessage::ScmCredentials(ucred) => {
308 let ucred_bytes = unsafe {
309 slice::from_raw_parts(addr_of!(ucred).cast::<u8>(), size_of_val(&ucred))
310 };
311 self.push_ancillary(ucred_bytes, c::SOL_SOCKET as _, c::SCM_CREDENTIALS as _)
312 }
313 #[cfg(target_os = "linux")]
314 SendAncillaryMessage::TxTime(tx_time) => {
315 let tx_time_bytes = unsafe {
316 slice::from_raw_parts(addr_of!(tx_time).cast::<u8>(), size_of_val(&tx_time))
317 };
318 self.push_ancillary(tx_time_bytes, c::SOL_SOCKET as _, c::SO_TXTIME as _)
319 }
320 }
321 }
322
323 /// Pushes an ancillary message to the buffer.
324 fn push_ancillary(&mut self, source: &[u8], cmsg_level: c::c_int, cmsg_type: c::c_int) -> bool {

Callers 9

sigsFunction · 0.80
path_with_terminationMethod · 0.80
ptsnameFunction · 0.80
path_with_terminationMethod · 0.80
extendMethod · 0.80
get_reaper_pidsFunction · 0.80
test_v4_txtimeFunction · 0.80
test_v6_txtimeFunction · 0.80
test_dir_seekFunction · 0.80

Calls 2

push_ancillaryMethod · 0.80
as_ptrMethod · 0.45

Tested by 3

test_v4_txtimeFunction · 0.64
test_v6_txtimeFunction · 0.64
test_dir_seekFunction · 0.64