use super::abi::*;
use crate::{
msghdr,
result_from_value,
AsRawFd,
};
/// Sends a message on a socket.
///
/// # Safety
///
/// `msg` must refer to a valid `msghdr` structure for the duration of the call.
#[inline]
pub unsafe fn sendmsg(fd: &impl AsRawFd, msg: &msghdr, flags: u32) -> crate::Result<usize> {
let ret = syscall_3(
46,
fd.as_raw_fd() as usize,
msg as *const msghdr as usize,
flags as usize,
);
result_from_value(ret)
}