-
Notifications
You must be signed in to change notification settings - Fork 675
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
Support sendmmsg/recvmmsg #1208
Conversation
Could you please fix the test failure before I review this PR? |
src/sys/socket/mod.rs
Outdated
Errno::result(ret).map(|r| r as usize) | ||
} | ||
|
||
#[cfg(any(target_os = "linux", target_os = "freebsd"))] |
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 looks like sendmmsg is also supported on Android, Dragonfly, NetBSD, and OpenBSD.
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.
Thanks, I will fix it. I didn't find the support on Dragonfly.
Looks like you have some test failures to fix. |
b8373d2
to
77421b1
Compare
src/sys/socket/mod.rs
Outdated
{ | ||
let iter = data.into_iter(); | ||
|
||
let (min_size, max_size) = iter.size_hint(); |
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.
How about adding a restriction to force IntoIterator::IntoIter
always be an ExactSizeIterator
? Additionally, use set_len
right after vector initialization instead of MaybeUninit
magic. It will simplify the whole logic of Vectors initializations, and prevent possible allocations. @asomers
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.
I think that's too great of a restriction. I don't know if I've seen a single Rust API that requires an ExactSizeIterator.
Oh, and please don't force-push until the end. It makes review harder. |
Looking a lot better. But it needs a more detailed review than my current level of sleepiness will allow. I'll set a reminder to do it tomorrow. Feel free to ping me if you don't hear anything for a few days. |
@glebpom I understand now the need for ExactSizeIterator in recvvmsg, and it seems reasonable. But I made a change to remove a mem::zeroed. Could you please review it? |
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.
I was also thinking about something like this. Looks good to me, thanks!
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.
bors r+
Build succeeded: |
… for sendmmsg() / recvmmsg() in nix-rust#1208. In nix-rust#1208, sendmmsg() / recvmmsg() were added, but OpenBSD(who doesn't support these) was included on the list of allowed operating systems for sendmmsg() related things. This broke the build on OpenBSD. For more Rust-world examples, see: rust-lang/libc@6f62973
1252: Add EV_DISPATCH, EV_RECEIPT items for EventFlags, and fix build on OpenBSD r=asomers a=nickpelone This pull request: - Adds `EV_DISPATCH` and `EV_RECEIPT` to `EventFlags`. OpenBSD supports these now. c379d1a - Fixes a regression that caused `nix` to be unable to build on OpenBSD since #1208. dd0a990 - Makes a change to avoid a deprecation warning from `libc` crate, which breaks tests. 0f9fcbd Since I know y'all don't have OpenBSD in CI right now, I've attached the results of a `cargo test` run on OpenBSD 6.7. Thanks for your time! [testresults.txt](https://github.com/nix-rust/nix/files/4684597/testresults.txt) Fixes #1251 Co-authored-by: Nick Pelone <nick.pelone@calyptix.com>
1252: Add EV_DISPATCH, EV_RECEIPT items for EventFlags, and fix build on OpenBSD r=asomers a=nickpelone This pull request: - Adds `EV_DISPATCH` and `EV_RECEIPT` to `EventFlags`. OpenBSD supports these now. c379d1a - Fixes a regression that caused `nix` to be unable to build on OpenBSD since #1208. dd0a990 - Makes a change to avoid a deprecation warning from `libc` crate, which breaks tests. 0f9fcbd Since I know y'all don't have OpenBSD in CI right now, I've attached the results of a `cargo test` run on OpenBSD 6.7. Thanks for your time! [testresults.txt](https://github.com/nix-rust/nix/files/4684597/testresults.txt) Fixes #1251 Co-authored-by: Nick Pelone <nick.pelone@calyptix.com>
This pull request adds
sendmmsg
andrecvmmsg
functions. They are used to send and receive multiple messages per one call. Additionally,AsMut
implemented for bothTimeSpec
andTimeVal
.This is still WIP, because we need to find the best way on how to pass multiple values to *mmsg functions. Current approach with iterators doesn't seem ergonomic.