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

Function send

src/backend/linux_raw/net/syscalls.rs:384–431  ·  view source on GitHub ↗
(fd: BorrowedFd<'_>, buf: &[u8], flags: SendFlags)

Source from the content-addressed store, hash-verified

382
383#[inline]
384pub(crate) fn send(fd: BorrowedFd<'_>, buf: &[u8], flags: SendFlags) -> io::Result<usize> {
385 let (buf_addr, buf_len) = slice(buf);
386
387 #[cfg(not(any(
388 target_arch = "aarch64",
389 target_arch = "mips64",
390 target_arch = "mips64r6",
391 target_arch = "riscv64",
392 target_arch = "s390x",
393 target_arch = "x86",
394 target_arch = "x86_64",
395 )))]
396 unsafe {
397 ret_usize(syscall_readonly!(__NR_send, fd, buf_addr, buf_len, flags))
398 }
399 #[cfg(any(
400 target_arch = "aarch64",
401 target_arch = "mips64",
402 target_arch = "mips64r6",
403 target_arch = "riscv64",
404 target_arch = "s390x",
405 target_arch = "x86_64",
406 ))]
407 unsafe {
408 ret_usize(syscall_readonly!(
409 __NR_sendto,
410 fd,
411 buf_addr,
412 buf_len,
413 flags,
414 zero(),
415 zero()
416 ))
417 }
418 #[cfg(target_arch = "x86")]
419 unsafe {
420 ret_usize(syscall_readonly!(
421 __NR_socketcall,
422 x86_sys(SYS_SEND),
423 slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
424 fd.into(),
425 buf_addr,
426 buf_len,
427 flags.into()
428 ])
429 ))
430 }
431}
432
433#[inline]
434pub(crate) fn sendto(

Callers

nothing calls this directly

Calls 2

sliceFunction · 0.85
ret_usizeFunction · 0.50

Tested by

no test coverage detected