rust/library/std/src
Dylan DPC 772582e19e
Rollup merge of #83374 - reyk:fix/bsd-ancillary, r=joshtriplett
unix: Fix feature(unix_socket_ancillary_data) on macos and other BSDs

This adds support for CMSG handling on macOS and fixes it on OpenBSD and possibly other BSDs.

When traversing the CMSG list, the previous code had an exception for Android where the next element after the last pointer could point to the first pointer instead of NULL.  This is actually not specific to Android: the `libc::CMSG_NXTHDR` implementation for Linux and emscripten have a special case to return NULL when the length of the previous element is zero; most other implementations simply return the previous element plus a zero offset in this case.

This MR makes the check non-optional which fixes CMSG handling and a possible endless loop on such systems; tested with file descriptor passing on OpenBSD, Linux, and macOS.

This MR additionally adds `SocketAncillary::is_empty` because clippy is right that it should be added.

This belongs to the `feature(unix_socket_ancillary_data)` tracking issue:  https://github.com/rust-lang/rust/issues/76915

r? `@joshtriplett`
2021-03-30 00:32:21 +02:00
..
backtrace Add Frames iterator for Backtrace 2021-01-23 11:56:33 -06:00
collections Use DebugStruct::finish_non_exhaustive() in std. 2021-03-27 13:29:23 +01:00
env std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
error std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
f32 std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
f64 std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
ffi ffi::c_str smaller as_bytes 2021-03-29 15:32:25 +03:00
fs std: Fix test got_symlink_permission on Windows 2020-11-16 21:09:26 +03:00
io Rollup merge of #83555 - m-ou-se:inline-io-error-new-const, r=jackh726 2021-03-27 20:37:13 +01:00
lazy Upgrade wasm32 image to Ubuntu 20.04 2021-02-06 13:05:56 +01:00
memchr std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
net Document that the SocketAddr memory representation is not stable 2021-03-26 19:44:06 +01:00
num rustc_expand: Mark inner #![test] attributes as soft-unstable 2020-11-20 19:35:03 +03:00
os Deprecate std::os::haiku::raw 2021-03-16 17:43:33 -04:00
panic review: fix nits and move panic safety tests to the correct place 2020-09-25 23:10:24 +02:00
path Refactor parse_prefix on Windows 2020-11-07 16:15:48 +01:00
prelude Deprecate RustcEncodable and RustcDecodable. 2021-03-15 20:16:16 +01:00
process std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
sync Rollup merge of #83561 - m-ou-se:lock-debug, r=jackh726 2021-03-28 01:33:21 +09:00
sys Rollup merge of #83374 - reyk:fix/bsd-ancillary, r=joshtriplett 2021-03-30 00:32:21 +02:00
sys_common Improve fs error open_from unix 2021-03-27 21:23:48 +08:00
thread Use DebugStruct::finish_non_exhaustive() in std. 2021-03-27 13:29:23 +01:00
time Duration::zero() -> Duration::ZERO 2020-10-21 20:44:03 -07:00
alloc.rs Fix safety comment 2021-01-07 09:13:21 +01:00
ascii.rs Convert many files to intra-doc links 2020-09-02 17:37:40 -04:00
backtrace.rs Add Frames iterator for Backtrace 2021-01-23 11:56:33 -06:00
env.rs Document security implications of std::env::temp_dir 2021-01-20 11:24:47 -08:00
error.rs Add tracking issue for map_try_insert. 2021-03-04 16:54:28 +01:00
f32.rs doc: cube root, not cubic root 2021-02-26 19:03:44 +01:00
f64.rs doc: cube root, not cubic root 2021-02-26 19:03:44 +01:00
fs.rs Rollup merge of #83558 - m-ou-se:use-finish-non-exhaustive, r=jackh726 2021-03-28 01:33:17 +09:00
keyword_docs.rs Fix broken doc link reference 2021-03-20 00:36:41 -04:00
lazy.rs Use DebugStruct::finish_non_exhaustive() in std. 2021-03-27 13:29:23 +01:00
lib.rs Use iter::zip in library/ 2021-03-26 09:32:29 -07:00
macros.rs Use #[doc = include_str!()] in std 2021-02-23 15:54:55 +01:00
memchr.rs std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
num.rs std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
panic.rs Fixed minor typo in catch_unwind docs 2021-02-13 16:59:06 +01:00
panicking.rs fix another comment, and make __rust_start_panic code a bit more semantically clear 2020-12-25 23:37:27 +01:00
path.rs Rollup merge of #81822 - Kixunil:path_try_exists, r=kennytm 2021-03-16 23:53:52 +09:00
primitive_docs.rs Rephrase -0.0 docs 2021-03-22 17:02:09 -07:00
process.rs Use DebugStruct::finish_non_exhaustive() in std. 2021-03-27 13:29:23 +01:00
rt.rs Prevent __rust_begin_short_backtrace frames from being tail-call optimised away 2020-08-07 19:31:25 +01:00
time.rs Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00