-
Notifications
You must be signed in to change notification settings - Fork 208
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
feat: make compile pass on windows #238
Conversation
a30e577
to
a4072ae
Compare
@CarrotzRule123 Could you please help me? |
09897ba
to
5424253
Compare
5424253
to
cdb4de1
Compare
Thank you so much! Supporting windows requires a lot of work.
? |
For example, in monoio/src/driver/op/send.rs:103 impl<T: IoBuf> Op<SendMsg<T>> {
pub(crate) fn send_msg(
fd: SharedFd,
buf: T,
socket_addr: Option<SocketAddr>,
) -> io::Result<Self> {
// manually assemble the libc::msghdr
// I think we should add `msg` submodule for `buf`
let iovec = [libc::iovec {
iov_base: buf.read_ptr() as *const _ as *mut _,
iov_len: buf.bytes_init(),
}];
let mut info: Box<(Option<SockAddr>, [libc::iovec; 1], libc::msghdr)> =
Box::new((socket_addr.map(Into::into), iovec, unsafe {
std::mem::zeroed()
}));
info.2.msg_iov = info.1.as_mut_ptr();
info.2.msg_iovlen = 1;
match info.0.as_ref() {
Some(socket_addr) => {
info.2.msg_name = socket_addr.as_ptr() as *mut libc::c_void;
info.2.msg_namelen = socket_addr.len();
}
None => {
info.2.msg_name = std::ptr::null_mut();
info.2.msg_namelen = 0;
}
}
Op::submit_with(SendMsg { fd, buf, info })
}
} I also have some doubts about |
Yes, you are right. It is used by unix datagram and seq_packet, so it is unix only. Manually construct msghdr should be ok. Maybe |
Got it, so I plan to use Then refer to the implementation of Any other suggestions? @ihciah |
For linux both |
Sure, I see the differences between the structures. |
eec0437
to
4611e48
Compare
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.
It's a great work, thank you!
Simply supporting compilation on Windows is already a huge workload. This PR solves most compilation errors, and I found that the
buf
module is missingmsg
. Do you plan to manually assemblelibc::msghdr
/windows_sys::Win32::Networking::WinSock::WSAMSG
directly? @ihciah