lx/syscalls/
sendmsg.rs

1use super::abi::*;
2use crate::{
3    msghdr,
4    result_from_value,
5    AsRawFd,
6};
7
8/// Sends a message on a socket.
9///
10/// # Safety
11///
12/// `msg` must refer to a valid `msghdr` structure for the duration of the call.
13#[inline]
14pub unsafe fn sendmsg(fd: &impl AsRawFd, msg: &msghdr, flags: u32) -> crate::Result<usize> {
15    let ret = syscall_3(
16        46,
17        fd.as_raw_fd() as usize,
18        msg as *const msghdr as usize,
19        flags as usize,
20    );
21    result_from_value(ret)
22}