Add sendmsg stub

This commit is contained in:
Jeremy Soller
2024-01-12 15:36:01 -07:00
parent eb3b93d14a
commit 52612784b6
6 changed files with 37 additions and 8 deletions
+20 -1
View File
@@ -2,13 +2,27 @@
use core::ptr;
use crate::platform::{types::*, PalSocket, Sys};
use crate::{
header::sys_uio::iovec,
platform::{types::*, PalSocket, Sys},
};
pub mod constants;
pub type sa_family_t = u16;
pub type socklen_t = u32;
#[repr(C)]
pub struct msghdr {
pub msg_name: *mut c_void,
pub msg_namelen: socklen_t,
pub msg_iov: *mut iovec,
pub msg_iovlen: size_t,
pub msg_control: *mut c_void,
pub msg_controllen: size_t,
pub msg_flags: c_int,
}
#[repr(C)]
#[derive(Default)]
pub struct sockaddr {
@@ -163,6 +177,11 @@ pub unsafe extern "C" fn send(
sendto(socket, message, length, flags, ptr::null(), 0)
}
#[no_mangle]
pub unsafe extern "C" fn sendmsg(socket: c_int, msg: *const msghdr, flags: c_int) -> ssize_t {
Sys::sendmsg(socket, msg, flags)
}
#[no_mangle]
pub unsafe extern "C" fn sendto(
socket: c_int,