Rustix no longer has anything in the tree that needs the `fs` module
when the public "fs" feature isn't enabled, so make the `fd` module
conditional on `cfg(feature = "fs")`.
As a followup to #444, remove the uid/gid checks from the procfs code
entirely. Procfs files can have their owner changed to root:root under
`PR_SET_DUMPABLE`, and root can be remapped to nobody by user
namespaces.
This check wasn't guarding against a known problem, and it's complex
to make sure it doesn't spuriously fail under any vald configuration,
so just remove it.
When a process is marked as non-dumpable, Linux changes the permissions
of the files under /proc/<pid> as owned by root:root. Relax the procfs
code, including removing use of `O_NOATIME`, so that it works on files
owned by `root:root`.
Fixes#441.
* Enable the "close" feature for io-lifetimes.
This follows up on #422, but enables "close" on the regular dependency
too, and not just the dev-dependency.
* Temporarily disable the backends no-libc test.
Update `src/net/ip.rs` and `src/net/addr.rs` to use the new std code,
making these structures platform independent.
Doesn't include the new Debug/Display formatting code for these
structures, although that could have been added now that it doesn't
depend on std anymore.
Do not resize internal buffer on error, otherwise iterator gets stuck in
infinite loop with zeroed `dirent`s after the first error. Correct
behavior is to return error indefinitely if it persists.
Error can be ENOENT if the directory is unlinked while iterating, for
example.
Signed-off-by: Aleksandr Trukhin <alxtry@gmail.com>
`#[cfg(target_feature = "thumb-mode")]` isn't available on stable, so
use a build.rs script to detect whether we can use `r7` in inline asm
on ARM targets.
Without this feature enabled the eventfd test crashes on my box:
---- eventfd::test_eventfd stdout ----
thread 'eventfd::test_eventfd' panicked at 'internal error: entered unreachable code: drop called without the "close" feature in io-lifetimes', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/io-lifetimes-1.0.0-rc1/src/types.rs:763:13
stack backtrace:
0: rust_begin_unwind
at /datastore/rpmbuild/BUILD/rustc-1.57.0-src/library/std/src/panicking.rs:517:5
1: core::panicking::panic_fmt
at /datastore/rpmbuild/BUILD/rustc-1.57.0-src/library/core/src/panicking.rs:100:14
2: <io_lifetimes::types::OwnedFd as core::ops::drop::Drop>::drop
at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/io-lifetimes-1.0.0-rc1/src/types.rs:763:13
3: core::ptr::drop_in_place<io_lifetimes::types::OwnedFd>
at /datastore/rpmbuild/BUILD/rustc-1.57.0-src/library/core/src/ptr/mod.rs:188:1
4: io::eventfd::test_eventfd
at ./tests/io/eventfd.rs:24:1
5: io::eventfd::test_eventfd::{{closure}}
at ./tests/io/eventfd.rs:3:1
6: core::ops::function::FnOnce::call_once
at /datastore/rpmbuild/BUILD/rustc-1.57.0-src/library/core/src/ops/function.rs:227:5
7: core::ops::function::FnOnce::call_once
at /datastore/rpmbuild/BUILD/rustc-1.57.0-src/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
I'm using this in an environment where only the `$TARGET` rust standard
library is available, which means `use std::arch::asm;` doesn't work for
the host platform when cross compiling, even when it works for the
target platform. Also in general, this is trying to detect things about
the target, not the host.
For context, I'm using [Bazel](https://bazel.build/) with
[rules_rust's cargo_build_script](http://bazelbuild.github.io/rules_rust/flatten.html#cargo_build_script),
via [cargo-raze](https://github.com/google/cargo-raze). Native
x86_64-unknown-linux-gnu compilation works fine without this patch, but
cross compiling to aarch64-unknown-linux-gnu requires this patch.
* 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.
* 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.
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!
Remove rustix::io::OwnedFd, and just use the std and io_lifetimes'
OwnedFd definition. Now that rustix is using io_lifetimes 1.0, which has
switched to using the `OwnedFd` in std, this is no longer needed.
This simplifies rustix' API, as users no longer have to be aware of the
difference between rustix::io::OwnedFd and rustix::fd::OwnedFd.