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

std: Avoid the WSA_FLAG_NO_HANDLE_INHERIT option #26658

Merged
merged 1 commit into from
Jul 2, 2015

Conversation

alexcrichton
Copy link
Member

This was added after Windows 7 SP1, so it's not always available. Instead use
the SetHandleInformation function to flag a socket as not inheritable. This is
not atomic with respect to creating new processes, but it mirrors what Unix does
with respect to possibly using the atomic option in the future.

Closes #26543

@alexcrichton
Copy link
Member Author

r? @aturon

@rust-highfive rust-highfive assigned aturon and unassigned nikomatsakis Jun 29, 2015
@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@aturon
Copy link
Member

aturon commented Jun 30, 2015

@bors: r+

We need to figure hammer out our story for using better APIs under the hood when available.

@bors
Copy link
Contributor

bors commented Jun 30, 2015

📌 Commit 0e06370 has been approved by aturon

@bors
Copy link
Contributor

bors commented Jun 30, 2015

⌛ Testing commit 0e06370 with merge abf6195...

@bors
Copy link
Contributor

bors commented Jun 30, 2015

💔 Test failed - auto-win-gnu-64-opt

@alexcrichton
Copy link
Member Author

@bors: r=aturon

On Tue, Jun 30, 2015 at 1:07 PM, bors [email protected] wrote:

[image: 💔] Test failed - auto-win-gnu-64-opt
http://buildbot.rust-lang.org/builders/auto-win-gnu-64-opt/builds/524


Reply to this email directly or view it on GitHub
#26658 (comment).

@bors
Copy link
Contributor

bors commented Jun 30, 2015

📌 Commit fb28133 has been approved by aturon

@bors
Copy link
Contributor

bors commented Jul 1, 2015

⌛ Testing commit fb28133 with merge 7dd2bd6...

@bors
Copy link
Contributor

bors commented Jul 1, 2015

💔 Test failed - auto-win-gnu-32-opt

This was added after Windows 7 SP1, so it's not always available. Instead use
the `SetHandleInformation` function to flag a socket as not inheritable. This is
not atomic with respect to creating new processes, but it mirrors what Unix does
with respect to possibly using the atomic option in the future.

Closes rust-lang#26543
@alexcrichton
Copy link
Member Author

@bors: r=aturon

On Tue, Jun 30, 2015 at 6:26 PM, bors [email protected] wrote:

[image: 💔] Test failed - auto-win-gnu-32-opt
http://buildbot.rust-lang.org/builders/auto-win-gnu-32-opt/builds/530


Reply to this email directly or view it on GitHub
#26658 (comment).

@bors
Copy link
Contributor

bors commented Jul 1, 2015

📌 Commit 8890089 has been approved by aturon

@sfackler sfackler mentioned this pull request Jul 1, 2015
@bors
Copy link
Contributor

bors commented Jul 1, 2015

⌛ Testing commit 8890089 with merge 10a45ad...

@bors
Copy link
Contributor

bors commented Jul 1, 2015

💔 Test failed - auto-linux-32-nopt-t

@alexcrichton
Copy link
Member Author

@bors: retry

On Wed, Jul 1, 2015 at 12:04 AM, bors [email protected] wrote:

[image: 💔] Test failed - auto-linux-32-nopt-t
http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/5556


Reply to this email directly or view it on GitHub
#26658 (comment).

@bors
Copy link
Contributor

bors commented Jul 1, 2015

⌛ Testing commit 8890089 with merge d2cf9f9...

bors added a commit that referenced this pull request Jul 1, 2015
This was added after Windows 7 SP1, so it's not always available. Instead use
the `SetHandleInformation` function to flag a socket as not inheritable. This is
not atomic with respect to creating new processes, but it mirrors what Unix does
with respect to possibly using the atomic option in the future.

Closes #26543
@alexcrichton
Copy link
Member Author

This passed all tests but one of our mac slaves disappeared so I'm going to merge manually.

@alexcrichton alexcrichton merged commit 8890089 into rust-lang:master Jul 2, 2015
@alexcrichton alexcrichton deleted the windows-net-no-inherit branch July 2, 2015 00:33
bors added a commit that referenced this pull request Dec 6, 2019
std:win: avoid WSA_FLAG_NO_INHERIT flag and don't use SetHandleInformation on UWP

This flag is not supported on Windows 7 before SP1, and on windows server 2008 SP2. This breaks Socket creation & duplication.
This was fixed in a previous PR. cc #26658

This PR: cc #60260 reuses this flag to support UWP, and makes an attempt to handle the potential error.
This version still fails to create a socket, as the error returned by WSA on this case is WSAEINVAL (invalid argument). and not WSAEPROTOTYPE.

MSDN page for WSASocketW (that states the platform support for WSA_FLAG_NO_HANDLE_INHERIT): https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw

CC #26543
CC #26518
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.

5 participants