rust/library/std/src/sys
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
..
hermit Rollup merge of #83353 - m-ou-se:io-error-avoid-alloc, r=nagisa 2021-03-24 01:52:29 +01:00
sgx Auto merge of #83387 - cuviper:min-llvm-10, r=nagisa 2021-03-25 13:11:18 +00:00
unix Rollup merge of #83374 - reyk:fix/bsd-ancillary, r=joshtriplett 2021-03-30 00:32:21 +02:00
unsupported Use io::Error::new_const everywhere to avoid allocations. 2021-03-21 20:22:38 +01:00
vxworks Use io::Error::new_const everywhere to avoid allocations. 2021-03-21 20:22:38 +01:00
wasi Use DebugStruct::finish_non_exhaustive() in std. 2021-03-27 13:29:23 +01:00
wasm sys: use process::abort() instead of arch::wasm32::unreachable() 2021-01-29 20:25:23 +01:00
windows Use io::Error::new_const everywhere to avoid allocations. 2021-03-21 20:22:38 +01:00
mod.rs Rollup merge of #82686 - CDirkx:unix-platform, r=m-ou-se 2021-03-22 02:20:28 +01:00