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

SOCK_NONBLOCK should re-export libc::SOCK_NONBLOCK #244

Closed
oh-its-jimjam opened this issue Jan 23, 2016 · 10 comments
Closed

SOCK_NONBLOCK should re-export libc::SOCK_NONBLOCK #244

oh-its-jimjam opened this issue Jan 23, 2016 · 10 comments
Labels

Comments

@oh-its-jimjam
Copy link

I believe there is a bug for SOCK_NONBLOCK as the value is not the same for all architectures so will break if it's used on a non-x86 architecture - like MIPS. For example the flag value is 128 on MIPS.

@oh-its-jimjam
Copy link
Author

I just noticed that you have a dependency to libc. I submitted a PR to add SOCK_NONBLOCK and SOCK_CLOEXEC flags to libc so you can potentially reference them and don't have to split your code into different architectures.

I'm happy to submit a PR for it when it's available in libc.

@kamalmarhubi
Copy link
Member

Thanks for taking a look. Bringing in the value from libc is probably the right thing to do.

@oh-its-jimjam
Copy link
Author

Alex has already merged the change into libc so I can submit a PR to you - hopefully tonight if I get time.

@kamalmarhubi
Copy link
Member

There's no release out with it yet, from what I could see, but thanks for tracking it!

@kamalmarhubi
Copy link
Member

@jamperry I just checked, both your commits made it into libc 0.2.6 which is out.

@Susurrus Susurrus changed the title Potential SOCK_NONBLOCK bug SOCK_NONBLOCK should re-export libc::SOCK_NONBLOCK Jun 5, 2017
@Susurrus
Copy link
Contributor

Susurrus commented Jun 5, 2017

@jamperry Any interest in filing a PR for this? Seems pretty straightforward since the constant is properly defined in libc.

@Susurrus Susurrus added the A-bug label Jun 5, 2017
Susurrus added a commit to Susurrus/nix that referenced this issue Aug 9, 2017
Susurrus added a commit to Susurrus/nix that referenced this issue Aug 9, 2017
Susurrus added a commit to Susurrus/nix that referenced this issue Aug 10, 2017
Susurrus added a commit to Susurrus/nix that referenced this issue Aug 10, 2017
Susurrus added a commit to Susurrus/nix that referenced this issue Aug 10, 2017
Susurrus added a commit to Susurrus/nix that referenced this issue Aug 10, 2017
Susurrus added a commit to Susurrus/nix that referenced this issue Aug 10, 2017
Susurrus added a commit to Susurrus/nix that referenced this issue Aug 11, 2017
Susurrus added a commit to Susurrus/nix that referenced this issue Aug 16, 2017
Susurrus added a commit to Susurrus/nix that referenced this issue Aug 17, 2017
@Susurrus
Copy link
Contributor

Susurrus commented Nov 7, 2017

I believe this is resolved as of f067e73.

@Susurrus Susurrus closed this as completed Nov 7, 2017
@kristate
Copy link

@kamalmarhubi @Susurrus
Does f067e73 account for target_os = "macos" target_os = "ios" ?

On MacOS:

error[E0599]: no associated item named `SOCK_NONBLOCK` found for type `nix::sys::socket::SockFlag` in the current scope

@kristate
Copy link

@kamalmarhubi @Susurrus
My apologies, it seems that SOCK_NONBLOCK does not exist in darwin.
I will stick to using fcntl() and friends, thanks.

@kristate
Copy link

@kamalmarhubi @Susurrus
Now I'm curious: nix::sys::socket::socket provides a fourth parameter that calls fcntl() but seemingly does not support macos. Opened an Issue (#861) for clarification. thanks.

kristate added a commit to kristate/nix that referenced this issue Feb 22, 2018
kristate added a commit to kristate/nix that referenced this issue Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants