Commit Graph

81 Commits

Author SHA1 Message Date
Dan Gohman cfad01449f Fix compilation on armv7-unknown-freebsd (#518)
* Fix compilation on armv7-unknown-freebsd

Use `time_t::MAX` to avoid depending on the relationship between
`time_t` and `c_long`.

* Silence the deprecation warning about `time_t`.
2023-01-17 12:40:15 -08:00
Alex Saveau dfcc45d79e Fix Fuchsia target (#504)
* Fix Fuchsia target

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Update main.yml

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2023-01-17 12:40:15 -08:00
Dan Gohman 5c23ff6773 Pin CI to Ubuntu 20.04 until #483 is sorted out. 2022-12-13 08:46:14 -08:00
Dan Gohman 4e2599b729 Run the tests on Rust 1.48, and check compilation of tests and examples on more targets (#465)
* Fix the tests to run on 1.48.

This puts the benchmarks behind a `criterion` cfg, so add
`--cfg=criterion` to RUSTFLAGS when running cargo bench.

An MSRV of 1.48 enables us to support users such as async-io, which also
has an MSRV of 1.48.

* Add a rust-version field.

This prints a warning under Rust 1.48, but only when rustix is the
top-level build; when rustix is a dependency, it doesn't warn, so this
seems ok.
2022-12-01 11:42:09 -08:00
Dan Gohman c7146a721e Fix compilation with --no-default-features. (#454)
Move `fcntl_getfd`, `fcntl_setfd`, and `fcntl_dupfd_cloexec` out of
the `fs` module and into the `io` module, since they're not specific
to files, directories or memfd. This allows them to be used with the
"fs" feature is not enabled.

Also, add public aliases for then in `fs`, for compatibility, and to
have a place where all `fcntl` function are present.

And add a CI check for --no-default-features with no API features.

Fixes #453.
2022-11-21 10:56:46 -08:00
Dan Gohman 19af9c3943 Update to actions/cache@v3. 2022-11-15 14:17:13 -08:00
Dan Gohman 812364ace3 Update to actions/checkout@v3. 2022-11-13 07:23:30 -08:00
Dan Gohman dd139fbfaa Update dependency versions. (#438)
Update the github action to node16. And update to memoffset 0.7.1 and
criterion 0.4.
2022-11-07 09:00:19 -08:00
Dan Gohman 35e62e6467 Fix linux-raw inline asm for thumb-mode. (#416)
* Fix linux-raw inline asm for thumb-mode.

In thumb-mode, r7 is reserved as the frame pointer and isn't permitted
as an inline asm operand. It's still the syscall-number operand in
syscalls though, so pass the syscall-number operand in in a separate
register, copy it into r7 inside the inline asm, and then restore the
value of r7 when we're done.

* Add a thumbv7neon-unknown-linux-gnueabihf line to CI.
2022-09-27 15:11:40 -07:00
Dan Gohman 350877a391 Fix compilation on sparc targets. (#417)
* Fix compilation on sparc targets.

Adjust cfg's as needed to fix compilation errors on sparc.

Fixes #408.

* Rust's 32-bit sparc Linux target has a 32-bit time_t.
2022-09-27 10:05:29 -07:00
Dan Gohman bb2855958e Add a CI check for building on Haiku. 2022-09-26 06:57:24 -07:00
Dan Gohman e5d9aa159f More fixes for compilation on x86_64-unknown-dragonfly. (#410)
Add a tier-3 CI check for x86_64-unknown-dragonfly, and fix the
compilation errors needed to compile with --features=all-apis.

This builds on top of #409!
2022-09-25 13:15:28 -07:00
Dan Gohman 95efd8ad02 Pin once_cell to 1.14 in Rust 1.48 builds. 2022-09-21 11:06:42 -07:00
Dan Gohman b0c34b998c Make the linux-raw-sys dependency non-optional on Linux.
Rustix's statx code now depends on linux-raw-sys, in order to obtain
Linux's `STATX__RESERVED` value, which musl doesn't export. As such,
always enable the linux-raw-sys dependency on Linux targets.

Fixes #389.
2022-08-17 14:00:41 -07:00
Dan Gohman c6c9b78b8a Update test-users.yml and add several more users.
Add several more users, add update the sed lines to handle the
`^version` match in the windows-sys dependency. All this sed+grep
code is pretty hairy, but it works for now.
2022-06-13 15:50:38 -07:00
Dan Gohman 0a8e27e336 Fix compilation on arm-linux-androideabi. (#364)
* Fix compilation on arm-linux-androideabi.

arm-linux-androideabi's `st_dev` is 64-bit, even though its `dev_t` is
32-bit.

* Move qemu arguments into qemu_args for mipsel and mips64el.

The cache script needs the name of the qemu binary without the args, so
always split the args into a separate variable.

* `linux_execfn` is unavailable on 32-bit Android.

* Fix types for non-x86 32-bit Android.

* Add aarch64-apple-ios as a cross target to CI.
2022-06-13 15:50:01 -07:00
Dan Gohman b99ed80b77 Fix dependencies for big-endian mips targets.
This makes main consistent with the changes mad in #343 in the 0.34.x
branch.
2022-06-02 10:34:53 -07:00
Dan Gohman ffd2ef83a4 Remove ZStr and ZString. (#337)
* Remove `ZStr` and `ZString`.

Use `CStr` and `CString` instead, now that nightly has then in core and
alloc, respectively.

Fixes #336.

* Enable "core_c_str" on nightly to use core::ffi::CStr.

* Don't test --no-default-features on stable.

--no-default-features disables "std", and building without "std" will
require nightly now.

* `CString` and `NulError` are in alloc.

* Add comments to the relevant Cargo.toml features.

* rustfmt
2022-05-27 07:37:16 -07:00
Dan Gohman 9e05bfba58 Disable the x86_64-uwp-windows-msvc cross-check for now. 2022-04-30 06:50:15 -07:00
Dan Gohman ff0f2e1f2e Update to qemu 7.0.0.
No particular urgency, just staying on top of updates.
2022-04-28 16:05:38 -07:00
Dan Gohman ce827448c9 Implement a new rustix::termios module. (#274)
* Implement a new `rustix::termios` module.

Implement a new termios module, containing tcdrain, tcflow, tcflush,
tcgetpgrp, tcgetsid, tcsendbreak, tcsetattr, tcsetpgrp, tcsetwinsize,
and all the cf* functions.

This also renames APIs like `ioctl_tcgets` to more POSIX-like names,
like `tcgetattr`.

* Put the termios API under a "termios" cargo feature.

In anticipation of #250, put the "termios" API under a "termios" feature.

* Move `isatty` into the termios API module.

* Make `RawMode` on x86 Android be `c_uint`.

Android's `mode_t` is `u16`, which is different than its `stat`'s
`st_mode`.

* Move `ttyname` into the `termios` module.
2022-04-18 15:38:53 -07:00
Dan Gohman 94898e10c0 Update the virtual-environment versions in the CI scripts.
windows-latest now refers to windows-2022, and macos-latest now refers
to macos-11. Update main.yml so that it doesn't test windows-2022
and macos-11 redundantly, and so that it does test macos-10.15 and
windows-2019.

In test-users.yml, use macos-latest instead of macos-11.
2022-04-14 21:26:02 -07:00
Dan Gohman bd5b596020 Add an "on workflow_dispatch" rule to the main.yml CI.
This will enable manually running the tests on branches other than main.
2022-04-13 07:51:10 -07:00
Dan Gohman 317f715ac1 Add an s390x-unknown-linux-gnu check to CI. 2022-04-13 07:00:06 -07:00
Dan Gohman 3e727c5d60 Configure qemu to set the nsec fields in fstat on s390x.
Add a config macro to qemu to tell it that s390x is intended to populate
the `*_nsec` fields in an `fstat` call.
2022-04-13 06:58:47 -07:00
Dan Gohman 5dab25141d Add CI testing for s390x-linux. 2022-04-12 19:13:48 -07:00
Dan Gohman 8f9a899bc2 Use c_uint rather than bool in getsockopt calls.
* Use `c_uint` rather than `bool` in `getsockopt` calls.

`getsockopt` and `setsockopt` represent boolean values as integers, not as
`bool` types. The code already handled this for `setsockopt`, but not
for `getsockopt`. Handle it for `getsockopt`, and add assertions to catch
accidental uses of `bool.

* Remove an incorrect workaround for the bug now being fixed.

* Make the internal `getsockopt`/`setsockopt` require `T: Copy`.

As in the standard library, require rustix's internal
`getsockopt`/`setsockopt`'s generic parameter to implement `Copy`, to
discourage use with bogus types.

* Use `RUST_BACKTRACE=full` to capture full CI test failure backtraces.

* Handle Windows' `getsockopt` writing fewer bytes than expected.

* Use `BOOL` for sockopt booleans on Windows.

And, wrap sockopt boolean values in a newtype to discourage misuse.
2022-04-12 19:10:24 -07:00
Dan Gohman 3bc6ada761 Remove windows-2016 from CI.
windows-2016 is now [deprecated] on Github Actions.

[deprecated]: https://github.com/actions/virtual-environments/issues/5238
2022-04-04 17:08:43 -07:00
Dan Gohman e9d1833d42 Add a tier-3 cross check for a uwp windows target. 2022-03-02 12:27:35 -08:00
Dan Gohman 7d2b9cf54d Update the feature detection for inline asm to work on stable Rust.
Inline asm is now stabilized in Rust 1.59, so we can now use it
without `#[feature(asm)], on stable and nightly. Update the detection
to detect the presence of `std::arch::asm`.
2022-02-28 13:53:50 -08:00
Dan Gohman 5cda795470 Fix the get/set-timeout getsockopt/getsockopt calls.
Qemu doesn't yet support `SO_RCVTIMEO_NEW`/`SO_SENDTIMEO_NEW`, and it
unfortunately returns a bogus int instead of properly failing. For now,
patch qemu to fail in this case. The qemu bug is now reported
upstream [here].

[here]: https://gitlab.com/qemu-project/qemu/-/issues/885

And, when converting from nanoseconds to microseconds for the `*_OLD`
calls, round up rather than rounding down, so that the resulting timeout
is at least as long as requested.

Make the time conversion in `set_socket_linger` round up.

And, add tests for `set_socket_linger` and several other sockopt calls.
2022-02-28 09:03:31 -08:00
Dan Gohman 57dc9b5f07 Use a patched qemu for running the async-io tests. 2022-02-22 13:13:01 -08:00
Dan Gohman 44ae52605c Add a musl-compatible prlimit64. 2022-02-22 09:34:53 -08:00
Dan Gohman 596e953580 mips64le and mipsel linux_raw support. 2022-02-16 17:49:59 -08:00
Dan Gohman 9bf17186c2 Switch to a single feature, use-libc, for the libc backend. (#229)
Closes: https://github.com/bytecodealliance/rustix/issues/215

Introduce a `use-libc` cargo feature, which allows downstream crates to enable the libc backend via cargo features.

This has the downside of introducing a linux-raw-sys dependency in linux builds that use the libc backend, however the linux-raw-sys dependency is not used.
2022-02-16 10:49:26 -08:00
Dan Gohman 2afc8d6442 Fix several issues in the test-users script. (#213)
* Fix several issues in the test-users script.

 - In the Rust build, use a downloaded LLVM to avoid needing the dependencies
   needed to build LLVM.
 - Fix the name of the ostree-rs-ext repository.
 - Install libostree-dev for the ostree-rs-ext build.
 - Launch a dbus-daemon for the dbus-rs tests to use.

* More fixes.

 - Set the fetch depth for Rust so that it can download LLVM.
 - Install at-spi2-core for dbus.

* Fix copypasta in a test.

* When building std, use the rustc-dep-of-std branch.

* Fetch the rustc-dep-of-std branch before rebasing over it.

* Run test-users.yml across multiple architectures.

* More testing.

Remove ostree-rs-ext because it depends on a newer version of libostree-dev
than available in the available virtual environments.
"Requested 'ostree-1 >= 2021.5' but version of OSTree is 2020.3"

* powerpc64le

* Add listenfd.

* Enable caching of the qemu build.

* Fix the assignments of the RUNNER variables.

* Set the rustix version to match the dependency version.

* Fix the thttp script.
2022-02-10 15:58:54 -08:00
Dan Gohman 77fb672103 Powerpc64le linux_raw support.
This mostly follows other architectures, however Rust's inline asm is currently
considered experimental on PowerPC, so this uses outline asm by default even on
Rust nightly.

Fixes #188.
2022-02-07 07:12:51 -08:00
Dan Gohman c38613506e Add a CI script to test rustix's reverse dependencies. (#212)
* Add a CI script to test rustix's reverse dependencies.

As suggested [here], add a CI script to test some of rustix's reverse
dependencies. For now, this runs on `workflow_dispatch` rather than all
PRs, as it takes a lot of time, and there are still some parts of the
test script that need fixing.

[here]: https://github.com/bytecodealliance/rustix/pull/197#issuecomment-1026926506

* Use actions/checkout, and fix the ostree-ext repo URL.

* Remove the sed lines for -alpha.0 versions.
2022-02-03 10:40:10 -08:00
Dan Gohman b33bcd6498 Add a cross-check for aarch64-unknown-linux-musl in CI. 2022-01-31 09:06:20 -08:00
Dan Gohman 6303edf4d7 Add a CI check for the prebuild debug-mode libraries.
The existing CI code checked it for --release builds; this ensures it's
checked for debug builds as well.

This also updates the debug builds which became out of date after
f7e4c56d added comments to the .s files, changing the line numbers in
the .debug_line sections.
2022-01-25 10:14:14 -08:00
Dan Gohman 27d3610c2a Fix compilation errors on illumos.
Make rustix compile under x86_64-unknown-illumos. This configuration is
not yet tested; this just fixes the compilation errors.
2022-01-19 14:30:14 -08:00
Dan Gohman c42ae9906d Test with the the "cc" feature enabled, in CI.
Enabling the "cc" feature causes the build.rs script to check that the
precompiled libraries match the libraries generated from source.

This also updates the libraries, in which the only change is the debug
info string mentioning the compilation directory chaging from "rsix"
to "rustix".
2022-01-12 08:55:30 -08:00
Dan Gohman 7263e4639d Fix a compilation error in --no-default-features --features=itoa mode. 2022-01-03 23:28:19 -06:00
Dan Gohman 1160f848fc Download qemu into the home directory in CI. 2021-12-23 16:04:36 -08:00
Dan Gohman 292c40f132 Test i686-linux-android cross-compilation. 2021-11-22 16:30:06 -08:00
Dan Gohman 04e7bf3825 Support Rust 1.48.
Add an MSRV of 1.48, and adjust the code to avoid depending on newer
versions.

Test 1.48, and test more macos and windows versions, and don't test
beta anymore.
2021-11-05 10:06:21 -07:00
Dan Gohman 4ef8c6a1d6 Rename rsix to rustix.
Fixes #98.
2021-11-04 15:16:20 -07:00
Dan Gohman b1bc4f6929 Temporarily disable rustc-dep-of-std testing in CI. 2021-11-04 05:26:22 -07:00
Dan Gohman ee91add9d2 Also use --no-default-features. 2021-11-04 05:26:22 -07:00
Dan Gohman 0902bece37 Don't use --nocapture with cargo check. And fix the feature name. 2021-11-04 05:26:22 -07:00