Since these are defined in C as macros, they must be reimplemented in
libc as Rust functions. They're hard to get exactly right, and they
vary from platform to platform. The test builds custom C code that uses
the real macros, and compares its output to the Rust versions' output
for various inputs.
Skip the CMSG_NXTHDR test on sparc64 linux because it hits a Bus Error.
Issue #1239
Skip the entire cmsg test program on s390x because it dumps core
seemingly before the kernel finishes booting.
Issue #1240
RFC 2235 - Implement PartialEq,Eq,Hash,Debug for all types
First pass at implementing [RFC2235](https://github.com/rust-lang/rfcs/blob/master/text/2235-libc-struct-traits.md). I just started with `PartialEq`/`Eq` and tested locally on my x64 Linux system. Definitely going to run into other types for other platforms that need this treatment, but thought I'd start small.
Open question is whether this should also rely on the `align` feature, which should improve which types can be auto-derived versus manually implemented (as it removed a lot of odd-sized padding arrays). My first pass here doesn't do that, but I might test it out to see if it does simplify quite a few structs. I think it might also be nice to have as it makes it easier for contributors to add new structs.
Part of rust-lang/rust#57715
Bump ctest from 0.2.6 to 0.2.7
Bumps [ctest](https://github.com/alexcrichton/ctest) from 0.2.6 to 0.2.7.
<details>
<summary>Commits</summary>
- See full diff in [compare view](https://github.com/alexcrichton/ctest/commits/0.2.7)
</details>
<br />
[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=ctest&package-manager=cargo&previous-version=0.2.6&new-version=0.2.7)](https://dependabot.com/compatibility-score.html?dependency-name=ctest&package-manager=cargo&previous-version=0.2.6&new-version=0.2.7)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme
Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
Finally, you can contact us by mentioning @dependabot.
</details>
This commit prepares the `libc` crate to be included directly into the
standard library via crates.io. More details about this can be found on
rust-lang/rust#56092, but the main idea is that this crate now depends
on core/compiler-builtins explicitly (but off-by-default).
The main caveat here is that this activates `no_core` when building as
part of libstd, which means that it needs to explicitly have an `iter`
and `option` module for the expansion of `for` loops to work.
Linux 4.18 added support for SIGSYS info in signalfd. Add the new
fields to signalfd_siginfo.
While the kernel has support for these new fields now, no libc has
shipped a release with the new signalfd fields.
Theoretically test statics
There are none of them in `libc` except for `__progname` on Android, but
that one cannot be tested because it's not present in any header files.
added EPOLL(5) for Illumos (Solaris fork)
EPOLL(5) is being used in crates like mio and iovec , this change allows those crates and other that depends on EPOLL(5) to be built in illumos systems.
These aren't exposed on non-MIPS musl targets, but since they're
part of a kernel API, they're still applicable, so we just don't
test them there but expose them anyways.
Initial fixes for linux x32
Tested with a local build of rustc. The main test can be compiled but fails to execute (receives SIGTRAP, which I think in this case indicates memory violation, I will open an issue in the rustc repo).
This PR is important because it fixes the definition of `c_long` and `c_ulong`. Without these fixes, rustc crash with the error:
```
Cannot emit physreg copy instruction
UNREACHABLE executed at /checkout/src/llvm/lib/Target/X86/X86InstrInfo.cpp:5778!
```
Related https://github.com/rust-lang/rust/issues/37976
Rebase of #610 and also move emscripten up much higher in the hierarchy to
ensure that it doesn't have too much of a ripple effect on other platforms.
This involved moving down a good number of definitions, but hopefully was done
with care to not break anything!
We now create an additional binary `linux_fcntl` for testing this
since there are header conflicts when including all necessary headers.
This binary is run on all platforms even though it's empty on all non-
Android/non-Linux platforms.
Testing has been switched from a custom binary to using a runner-less
test (or pair of tests). This means that for local development a simple
`cd libc-test && cargo test` will run all the tests. CI has also been
updated here to reflect that.
It's now broken due to changes in the `gcc` crate and having a too-old compiler,
and in general it's unfortunately architecturally so different from the other
test frameworks that it's difficult to maintain over time.
Add KERN_USERMOUNT and KERN_ARND to don't check list on OpenBSD
These [two constants are no longer in OpenBSD](3f376b0849/sys/sys/sysctl.h (L133-L140)). They were preventing the the tests from passing. With this change the test now pass:
```
CC=egcc cargo run
Compiling libc v0.2.29 (file:///home/vagrant/libc)
Compiling libc-test v0.1.0 (file:///home/vagrant/libc/libc-test)
Finished debug [unoptimized + debuginfo] target(s) in 11.7 secs
Running `/home/vagrant/libc/target/debug/libc-test`
RUNNING ALL TESTS
PASSED 5935 tests
```
They are still present in bitrig so I moved them there.
It needs to be skipped during testing because there's no way to include
a combination of headers that will expose it without giving a "type has
already been defined" error.