Skip to content
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

Remove emulation of FD_CLOEXEC/O_NONBLOCK #907

Merged
merged 1 commit into from
Jun 2, 2018

Conversation

Susurrus
Copy link
Contributor

@Susurrus Susurrus commented Jun 1, 2018

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

// 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should go.

@@ -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> {
Copy link
Member

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.
@Susurrus
Copy link
Contributor Author

Susurrus commented Jun 2, 2018

@asomers should be good here I think.

Copy link
Member

@asomers asomers left a 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+

bors bot added a commit that referenced this pull request Jun 2, 2018
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 <bryantmairs@google.com>
@bors
Copy link
Contributor

bors bot commented Jun 2, 2018

@bors bors bot merged commit 7e870c0 into nix-rust:master Jun 2, 2018
@kristate
Copy link

kristate commented Jun 2, 2018

@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?

@Susurrus
Copy link
Contributor Author

Susurrus commented Jun 2, 2018

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.

@Susurrus Susurrus deleted the remove_em branch June 2, 2018 03:18
@Susurrus Susurrus mentioned this pull request Jun 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants