Fix _CMSG_ALIGN on DragonFly
The attempted fix in #2610 originally had `7` hard coded, but it was suggested I replace this with a size_of call. Unfortunately the suggestion omitted a subtraction from the size_of call, and I didn't catch it.
Tested by running the failing `nix` tests on DragonFly (and didn't change the code again after running the tests).
The last fix originally had 3 hard coded, but it was suggested I replace
this with a size_of call. Unfortunately the suggestion omitted a
subtraction from the size_of call, and I didn't catch it.
add CI for armv7-unknown-linux-uclibceabihf
As discussed in https://github.com/rust-lang/libc/pull/2636, this is a framework for CI on targets with no prebuilt std. They will build via `nightly` and `-Zbuild-std`, and run the unit tests via qemu-user (or whatever else the dockerfile specifies).
It seems like I could write some more documentation about how to add more targets of this type, but perhaps I can get a round of feedback on the mechanism here before I go and write that.
Fix the build on the latest FreeBSD 14 snapshot
* KERN_STACKTOP was recently removed upstream, and has never been included in a stable FreeBSD release
* The MNTK_ flags are for kernel use only and aren't visible to userland
cc `@GuillaumeGomez`
uclibc: fix O_TMPFILE value, hide some unused fields to fix libc-test
This was a bit of a yak-shave.
First, O_TMPFILE was wrong because 020000000 is decimal, not octal. 🤦 This was, of course, causing all sorts of things to be horrible.
That led me to switch to a newer toolchain which actually defined O_TMPFILE, so that the libc tests pass on `armv7-unknown-linux-uclibceabihf`.
That revealed that certain field names had changed since the last time I ran the libc tests on this architecture, which revealed that some struct fields (e.g. `__unused`) were being marked as `pub` where all other architectures left them as private.
So, this patch might seem somewhat sprawling, but without all of these changes it's not possible to run libc-test!
To test:
* get https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/armv7-eabihf--uclibc--bleeding-edge-2021.11-1.tar.bz2
* unpack somewhere, and call that `$TOOLCHAIN`
```
cd libc-test
PATH=$TOOLCHAIN/bin:$PATH \
CC_armv7_unknown_linux_uclibc=armv7-buildroot-linux-uclibc-gcc \
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_LINKER=armv7-buildroot-linux-uclibc-gcc \
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_RUNNER="qemu-arm -L $TOOLCHAIN/arm-buildroot-linux-uclibcgnueabihf/sysroot/" \
cargo +nightly test --target armv7-unknown-linux-uclibceabihf -Zbuild-std=core,std
```
These are only for the kernel's internal use and aren't exposed to
userland. They also aren't stable across versions, and may be changed
or deleted at any time. For example, by
4dcdf3987c
It got removed by upstream. This should not be considered a breaking
change, because KERN_STACKTOP has never been included in a released
version of FreeBSD.
1544f5add8
uclibc: Don't specialize PTRACE_O_MASK for uclibc
This constant comes from the kernel headers, so its value should not depend on the libc type.
To test: see instructions in https://github.com/rust-lang/libc/pull/2566
define TIOCGWINSZ as c_ulong under arm-uclibc.
I'm trying to bring up a new target for rust, `armv7-unknown-linux-uclibceabi (softfloat)`. https://github.com/rust-lang/rust/pull/92383 Looks like a lot of work has already been hashed out from the recent addition of `armv7-unknown-linux-uclibceabihf`. The only issue I'm currently seeing is when I encounter `TIOCGWINSZ` in a couple places. This is the error I see.
```
Compiling termize v0.1.1 (/mmc/.cargo/registry/src/github.com-1285ae84e5963aae/termize-0.1.1)
error[E0277]: the trait bound `u32: From<i32>` is not satisfied
--> src/platform/unix.rs:12:43
|
12 | let mut result = ioctl(STDOUT_FILENO, TIOCGWINSZ.into(), &mut window);
| ----- ^^^^^^^^^^^^^^^^^ the trait `From<i32>` is not implemented for `u32`
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<u32 as From<Ipv4Addr>>
<u32 as From<NonZeroU32>>
<u32 as From<bool>>
<u32 as From<char>>
and 2 others
= note: required because of the requirements on the impl of `Into<u32>` for `i32`
error[E0277]: the trait bound `u32: From<i32>` is not satisfied
```
I see the error in the `termize` crate, and also `shell.rs` in the cargo source.
My current fix is to define TIOCGWINSZ as c_ulong under arm-uclibc.
I don't want to break anything with the established `armv7-unknown-linux-uclibceabihf` target so perhaps `@skrap` could chime in and take a look. Maybe a better solutions exists.
Fix definitions for the s390x-musl target.
When I was creating the original s390x musl definitions, I copied a little too closely from glibc for the ioctl(2) constants. This was then exacerbated in c7c238d812 with the creation of an erroneous definition.
On musl, these constants must be ints, not ulongs. On glibc, they are
ulong, and as such, were erroneously included as ulongs in the initial
s390x-musl definitions.
ioctl(2) always takes an int as the request, not a ulong, on musl.
I copied a little too closely from the glibc definitions when creating
the original s390x-musl ones.