]> git.lizzy.rs Git - rust.git/commit
Auto merge of #31417 - alexcrichton:cloexec-all-the-things, r=brson
authorbors <bors@rust-lang.org>
Sat, 6 Feb 2016 15:15:56 +0000 (15:15 +0000)
committerbors <bors@rust-lang.org>
Sat, 6 Feb 2016 15:15:56 +0000 (15:15 +0000)
commitbe2ffddffb1c8e56a673c3bf29fae780e1ef53c5
treed8491d6e538b249499dd44d4b0e6d224749b6eda
parent695c907dcc7c81c5fc052f426f7764476c12cf15
parent812b309c4791e08aa5bd8dda26c820af43c5fa29
Auto merge of #31417 - alexcrichton:cloexec-all-the-things, r=brson

These commits finish up closing out https://github.com/rust-lang/rust/issues/24237 by filling out all locations we create new file descriptors with variants that atomically create the file descriptor and set CLOEXEC where possible. Previous support for doing this in `File::open` was added in #27971 and support for `try_clone` was added in #27980. This commit fills out:

* `Socket::new` now passes `SOCK_CLOEXEC`
* `Socket::accept` now uses `accept4`
* `pipe2` is used instead of `pipe`

Unfortunately most of this support is Linux-specific, and most of it is post-2.6.18 (our oldest supported version), so all of the detection here is done dynamically. It looks like OSX does not have equivalent variants for these functions, so there's nothing more we can do there. Support for BSDs can be added over time if they also have these functions.

Closes #24237