Fix undefined-behavior on MacOSX structs in stdbuilds
Some MacOSX structs have an incorrect layout that results in undefined behavior. This is because on `x86_64` the MacOSX kernel headers define these using `#pragma pack 4`.
This PR fixes their layout using `repr(packed(4))` . Since it is only available on nightly, it is only enabled for stdbuilds .
Make netlink struct fields public
I realized my netlink structs were a bit unusable if their fields are not public 🤦♂️
Follow up and improvement to #922
Add PTHREAD_*_MUTEX_INITIALIZER_NP for glibc
`pthread_mutex_t` varies across architectures, in several ways:
- endianness alters the ordering of bytes, since the contents of the
struct are larger than 8-bit.
- its length varies.
- the location of the mutex kind (`PTHREAD_MUTEX_RECURSIVE`,
`PTHREAD_MUTEX_ERRORCHECK` or `PTHREAD_MUTEX_ADAPTIVE_NP`) varies
between 32-bit and 64-bit: On 32-bit architectures, it is preceded by
three int/unsigned int, while on 64-bit architectures, it is preceded
by four of them.
These initializers are only available from <pthread.h> when _GNU_SOURCE
is defined.
`pthread_mutex_t` varies across architectures, in several ways:
- endianness alters the ordering of bytes, since the contents of the
struct are larger than 8-bit.
- its length varies.
- the location of the mutex kind (`PTHREAD_MUTEX_RECURSIVE`,
`PTHREAD_MUTEX_ERRORCHECK` or `PTHREAD_MUTEX_ADAPTIVE_NP`) varies
between 32-bit and 64-bit: On 32-bit architectures, it is preceded by
three int/unsigned int, while on 64-bit architectures, it is preceded
by four of them.
These initializers are only available from <pthread.h> when _GNU_SOURCE
is defined.
Relax the cfg_if check in ci/style.rs to allow #[cfg(target_endian)]
tests.
Fix libstd build for mips*-unknown-linux-uclibc
The getrandom syscall related constant were missing. This PR adds full syscall table just in case and few other nits.
Include ioctl commands for becoming controlling tty and setting window
size. This enables https://github.com/jwilm/alacritty to be built and
run on OpenBSD 6.3. NetBSD and kin share the same command constants.
The libc crate is used as a dependency of the Rust compiler. Its build
system passes `--cfg dox` to all crates when generating their
documentation. libc's documentation is generated when the build system
is asked to generate the compiler documentation because `cargo doc`
automatically documents all dependencies.
When the dox configuration option is enabled, libc disables its
dependency on the core crate and provides the necessary definitions
itself. The dox configuration option is meant for generating
documentation for a multitude of targets even if the core crate for that
target is not installed. However, when documenting the compiler, it's
not necessary to do that; we can just use core or std as usual.
This change is motivated by the changes made to the compiler in
rust-lang/rust#48171. With these changes, it's necessary to provide
implementations of the Clone and Copy traits for some primitive types in
the library that defines these traits (previously, these implementations
were provided by the compiler). Normally, these traits (and thus the
implementations) are provided by core, so any crate that uses
`#![no_core]` must now provide its own copy of the implementations.
Because libc doesn't provide its own copy of the implementations yet,
and because the compiler's build system passes `--cfg dox` to libc,
generating the documentation for the compiler fails when generating
documentation for libc. By renaming the configuration option, libc will
use core or std and will thus have the necessary definitions for the
documentation to be generated successfully.