Skip to content

Conversation

@alexcrichton
Copy link
Member

This commit modifies the socket creation functions on windows to always specify
the WSA_FLAG_OVERLAPPED and WSA_FLAG_NO_HANDLE_INHERIT flags by default. The
overlapped flag enables IOCP APIs on Windows to be used with the socket at no
cost, enabling better interoperation with external libraries. The no handle
inherit flag mirrors the upcoming change to Unix to set CLOEXEC by default for
all handles.

Closes #24206

@rust-highfive
Copy link
Contributor

r? @brson

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

@brson
Copy link
Contributor

brson commented Apr 8, 2015

Would it be appropriate to extend the docs to indicate that these are on by default?

@alexcrichton
Copy link
Member Author

Hm I definitely think it would be appropriate! I'm not quite sure where said docs would go though as we don't currently have many platform-specific docs. Would you be ok if I opened a bug in the meantime for this topic?

Copy link
Contributor

Choose a reason for hiding this comment

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

These are incorrect

#define WSA_FLAG_OVERLAPPED           0x01
#define WSA_FLAG_NO_HANDLE_INHERIT    0x80

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, good catch!

This commit modifies the socket creation functions on windows to always specify
the `WSA_FLAG_OVERLAPPED` and `WSA_FLAG_NO_HANDLE_INHERIT` flags by default. The
overlapped flag enables IOCP APIs on Windows to be used with the socket at no
cost, enabling better interoperation with external libraries. The no handle
inherit flag mirrors the upcoming change to Unix to set CLOEXEC by default for
all handles.

Closes rust-lang#24206
@alexcrichton alexcrichton force-pushed the windows-wsa-flag-overlapped branch from 9013a57 to 433f0e8 Compare April 14, 2015 18:09
@alexcrichton
Copy link
Member Author

r? @aturon

@rust-highfive rust-highfive assigned aturon and unassigned brson Apr 14, 2015
@aturon
Copy link
Contributor

aturon commented Apr 15, 2015

re: docs, I believe we discussed having a "Platform behavior" subsection as part of the IO audit. But yes, this can wait for that sweep.

Meanwhile,

@bors: r+

@bors
Copy link
Collaborator

bors commented Apr 15, 2015

📌 Commit 433f0e8 has been approved by aturon

bors added a commit that referenced this pull request Apr 15, 2015
…uron

This commit modifies the socket creation functions on windows to always specify
the `WSA_FLAG_OVERLAPPED` and `WSA_FLAG_NO_HANDLE_INHERIT` flags by default. The
overlapped flag enables IOCP APIs on Windows to be used with the socket at no
cost, enabling better interoperation with external libraries. The no handle
inherit flag mirrors the upcoming change to Unix to set CLOEXEC by default for
all handles.

Closes #24206
@bors
Copy link
Collaborator

bors commented Apr 15, 2015

⌛ Testing commit 433f0e8 with merge af1c39c...

@bors
Copy link
Collaborator

bors commented Apr 15, 2015

@bors bors merged commit 433f0e8 into rust-lang:master Apr 15, 2015
@alexcrichton alexcrichton deleted the windows-wsa-flag-overlapped branch April 30, 2015 02:13
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.

On windows, initialize IO types (for example, sockets) with WSA_FLAG_OVERLAPPED

6 participants