-
Notifications
You must be signed in to change notification settings - Fork 689
Remove emulation of FD_CLOEXEC/O_NONBLOCK #907
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
Conversation
src/sys/socket/mod.rs
Outdated
// little easier to understand by separating it out. So we have to merge these bitfields | ||
// here. | ||
let mut ty = ty as c_int; | ||
ty |= flags.bits(); | ||
|
||
// TODO: Check the kernel version |
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.
This comment should go.
src/sys/socket/mod.rs
Outdated
@@ -810,45 +766,9 @@ pub fn accept(sockfd: RawFd) -> Result<RawFd> { | |||
/// | |||
/// [Further reading](http://man7.org/linux/man-pages/man2/accept.2.html) | |||
pub fn accept4(sockfd: RawFd, flags: SockFlag) -> Result<RawFd> { |
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.
Looks like OSX lacks accept4, and NetBSD only has it on the unstable development version. So you should gate this function.
Rather than using the native implementation of these constants on supported platforms, the native implementation was instead emulated. This was also hidden from the user even though this could result in data races and the functionality being broken. Native functionality is, however, not support on macos/ios. Rather than enable this emulation solely for this platform, it should be removed as this is a dangerous abstraction.
@asomers should be good here I think. |
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.
Yep, looks good.
bors r+
907: Remove emulation of FD_CLOEXEC/O_NONBLOCK r=asomers a=Susurrus Rather than using the native implementation of these constants on supported platforms, the native implementation was instead emulated. This was also hidden from the user even though this could result in data races and the functionality being broken. Native functionality is, however, not support on macos/ios. Rather than enable this emulation solely for this platform, it should be removed as this is a dangerous abstraction. This is a replacement for #863. There is much previous discussion there which I recommend you read to familiarize yourself with this decision. I'm looking to push this through rather quickly as it's the last thing blocking our next 0.11.0 release. cc @aomser @kristate Co-authored-by: Bryant Mairs <[email protected]>
@Susurrus You seem to be using my test cases from #863 in this commit [ref], but I am curious why you did not add me as a committer to this commit/patch? |
Sorry, you're right! I meant to just run them through the tests before merging them, but I should have talked to you before doing it at all. I'm really sorry about that! How would you like to handle this? I'd be happy to remove the test cases and you could file an additional PR with just those test cases so we can get it logged in git history that they're your work. |
Rather than using the native implementation of these constants
on supported platforms, the native implementation was instead
emulated. This was also hidden from the user even though this
could result in data races and the functionality being broken.
Native functionality is, however, not support on macos/ios.
Rather than enable this emulation solely for this platform, it
should be removed as this is a dangerous abstraction.
This is a replacement for #863. There is much previous discussion there which I recommend you read to familiarize yourself with this decision.
I'm looking to push this through rather quickly as it's the last thing blocking our next 0.11.0 release.
cc @aomser @kristate