New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for sendmmsg/recvmmsg #494
base: master
Are you sure you want to change the base?
Conversation
FreeBSD use a `size_t` for the `len` argument, while other UNIX-likes use an `unigned int`.
From a quick glance, Windows does not have the equivalent syscall in the WinSock API.
cd55c15
to
f6cfed8
Compare
This one is great. The whole unix world uses an int for the flags, and documents it as such. But musl uses an unsigned int there [1], while still documenting a signed int. This API is cursed. [1]: https://git.musl-libc.org/cgit/musl/tree/include/sys/socket.h?id=39838619bb8b65a8897abcfda8c17ad6de0115d8#n70
For some braindead reason, old versions of android on 32 bit defined socklen_t to be an int, instead of the unsigned int it was everywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried using &[MsgHdr]
and &mut [MshHdrMut]
instead of new types (MmsgHdr
and MmsgHdrMut
)?
Sadly yes, but this is not possible because |
target_vendor = "apple" | ||
)) | ||
))] | ||
pub struct MmsgHdr<'addr, 'bufs, 'control> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about matching mmsghdr
here? For example
pub struct MmsgHdr<'addr, 'bufs, 'control> {
msg: MsgHdr,
len: libc::c_uint,
}
This way the caller can decide if they want to use a Vec
, a slice an array or something else.
This PR aims to add support for the
sendmmsg
/recvmmsg
syscalls.The API exposed here is a bit simplified, where the "user friendly" functions don't expose the scatter/gather stuff (the
_vectored
variants found forrecvmsg
/sendmsg
). This was not exposed to not blow up the API surface, while keeping the functionality usingMmsgHdr(Mut)
for advanced usages.Thanks!