* 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.
* Add a `Result` to `getpgid`, and add `getpgrp`.
Add a `Result` return type to `getpgid`, as it can fail if there's no
process with the given pid.
And, add a a `getpgrp` function, which is similar to `getpgid`, but
doesn't take a pid argument and always operates on the current process,
which means it doesn't need a `Result` return type.
* Use `getpgid` on platforms which don't have a `getpgrp` syscall.
* Implement `statvfs` and `fstatvfs`.
On libc, just go with whatever the libc `statvfs` gives us. On
linux_raw, translate the fields from `statfs` in the manner of
libc implementations.
* Preserve as much of the `f_fsid` field as possible.
* Document the relationship between `statfs` and `statvfs`.
* Add a `StatVfsMountFlags` type for the `f_flag` field.
* Avoid using `.init_array` and `__environ` on non-musl non-glibc platforms.
Don't assume that non-musl non-glibc platforms have `.init_array` and
`__environ`; use an explicit `init` function on such platforms, and add a
`debug_assert` to check that it's called.
* Add a safety comment.
* Move the auxv functions into a new top-level "param" module.
"param" is short for "process parameter".
* Use `CStr` instead of `ZStr`.
* 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
Add support for glibc's y2038 APIs in the libc backend.
The musl and android targets are not y2038 compatible on 32-bit
platforms, however in musl's case, this will be fixed when Rust itself
is updated to musl 1.2, and in android's case, this is because android
itself does not intend to be y2038-compatible on 32-bit platforms.
This strengthen's rustix's y2038 stance to: support y2038 compatibility
on platforms which have support for this.
* Introduce API features.
* Don't use doc_cfg on internal modules.
* Don't compile the net code when the "net" feature is not present.
* Don't compile the runtime code when the "runtime" feature is not present.
* Don't compile the thread code when the "thread" feature is not present.
* Don't compile the time code when the "time" feature is not present.
* Don't compile the fs code when the "fs" feature is not present.
* Don't compile the rand code when the "rand" feature is not present.
* Split an "mm" feature out of the "io" module.
* Make some parts of "process"' implementation conditional.
* "Inline" the use declarations in src/imp/linux_raw/fs/mod.rs.
* Export `Timespec` and `ClockId` in `crate::thread`.
* io_uring depends on types from fs and net.
* Re-export Timespec etc. in crate::fs and crate::thread.
This makes it easier to disable crate::time when the time module is not
enabled.
* Ensure that tests and examples compile when features are disabled.
* Fix compilation.
Functions that take `<Fd: AsFd>` parameters can take `BorrowedFd`
arguments by value; it's not necessary to pass `BorrowedFd` values
by reference anymore.
This patch contains three fixes:
- Fix a missing documentation comment on s390x.
- Remove an unnecessary ptr2int cast which would break strict-provenance.
- Adjust test_priorities to work even if run with the lowest priority.
* Internal tidying: move more implementation details out of mod.rs files.
To make mod.rs files tidier, move some implementation details out of
mod.rs files and into the underlying source files.
This is also a first step towards #250.
* Be consistent about using `c::` instead of `libc::`.
* Add more constants to linux_raw's `c` module.
This reduces the need for verbose `linux_raw_sys::general::` qualifiers
in many places, and eliminates some differences between the libc and
linux_raw code paths.
* Make statx available on all Linux platforms by using `weak_or_syscall`.
This fixes unused-type errors, and also eliminates a public API
difference between glibc and musl.
And, it requires teaching the `syscall` macro how to pass `BorrowedFd`
values to `syscall` calls.
* Provide a definition of `struct statx` for non-glibc.
Musl and Android don't have a public `struct statx`, so provide a manual
declaration for them. And, add a `StatxTimestamp` for working with
`Statx`.
* Define `StatxFlags` for non-glibc, and add the `MNT_ID` flag.
* Add SYS_statx definitions for Android.
* Fix compilation on wasm32-wasi.
* Fix c_long.
* Fix a warning.
* Fix compilation on x86_64-uwp-windows-msvc.
This test is dangerous as it can end up waiting for unrelated child
processes. In theory, we could fix this by spawning a separate process
that we completely control and running the test within that process,
but for now, just disable the test.
Make `Pid` a non-zero type and use `Option<Pid>` in places where a pid
value can be zero. This lets `fork`'s API use an `Option` instead of a
sentry value, which is cleaner.