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

add missing socket constants #656

Merged
merged 1 commit into from
Jul 10, 2017
Merged

Conversation

ndusart
Copy link
Contributor

@ndusart ndusart commented Jul 9, 2017

Add some missing socket constants that are hardcoded by nix (nix-rust/nix#647)

I took the opportunity to merge some constants in a upper module when applicable.

@ndusart
Copy link
Contributor Author

ndusart commented Jul 9, 2017

Fixes #655

@ndusart ndusart force-pushed the socket-consts branch 3 times, most recently from 9e67a48 to 3c105fb Compare July 9, 2017 12:45
@ndusart
Copy link
Contributor Author

ndusart commented Jul 9, 2017

I've got some problems defining SO_RESTRICTION and SO_RESTRICT_* constants for apple platforms.

These are defined in sys/socket.h: https://github.com/opensource-apple/xnu/blob/dc0628e187c3148723505cf1f1d35bb948d3195b/bsd/sys/socket.h#L188-L190
in a #ifdef PRIVATE block, but even when defining it in build.rs (using cfg.define("PRIVATE", None)), it fails to get these constants.

@alexcrichton Do I misused the ctest generator for this ?

@alexcrichton
Copy link
Member

Nah I can see -DPRIVATE passed but it looks like that's not working? Maybe these can't be defined for OSX yet?

@ndusart
Copy link
Contributor Author

ndusart commented Jul 9, 2017

Yes maybe :/

I removed them from this PR then. I will discuss in nix if they keep them.

@Susurrus
Copy link
Contributor

Susurrus commented Jul 9, 2017

Reproducing my comment in nix-rust/nix#647 here:

Those constants don't actually exist on Mac as of 10.11.6 (I have one locally). I did grep SO_RESTRICT -r /usr/include and turned up nothing. Additionally I looked through /usr/include/sys/socket.h and those constants are gone (though the values aren't reused by other constants).

I think the PRIVATE constant is a good hint that these should never have been used by external code anyways, so it's unsurprising that they've removed them. I don't think they should be added to libc.

@ndusart
Copy link
Contributor Author

ndusart commented Jul 9, 2017

OK it's RTM then.

@ndusart
Copy link
Contributor Author

ndusart commented Jul 10, 2017

Just added missing SOCK_RDM for linux and android.

Really ready to be merged now :)

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Jul 10, 2017

📌 Commit 9f5766f has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Jul 10, 2017

⌛ Testing commit 9f5766f with merge 472ffbb...

bors added a commit that referenced this pull request Jul 10, 2017
add missing socket constants

Add some missing socket constants that are hardcoded by `nix` (nix-rust/nix#647)

I took the opportunity to merge some constants in a upper module when applicable.
@bors
Copy link
Contributor

bors commented Jul 10, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 472ffbb to master...

@bors bors merged commit 9f5766f into rust-lang:master Jul 10, 2017
@ndusart ndusart deleted the socket-consts branch July 10, 2017 15:00
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

4 participants