Move sched_getaffinity back to Linux
This reverts commit c1a3f8576ea12b0bed68ad3dedf4069ca3d9816f. The shim isn't actually useful for anything, and it is untested on FreeBSD. On Linux it exists solely because std and num_cpus are trying this before falling back to `sysconf`, but on FreeBSD that's not how they work, so there's no reason I can see to have this stub shim on FreeBSD.
sync: better error in invalid synchronization primitive ID
`@devnexen` this should fix the ICE in your PR (but it won't fix the code, it will just report proper UB instead).
update 'unsupported' message
Instead of "the interpreter", just say Miri.
Also be a more more clear about what is expected to be supported and what not (Cc https://github.com/rust-lang/miri/issues/2325).
Make file descriptors into refcount references
fixes#3525
Remove `fn dup` in `trait FileDescription`, define `struct FileDescriptor(Rc<RefCell<dyn FileDescription>>)`, and use `BTreeMap<i32, FileDescriptor>` in `FdTable`.
---
There are some refactors similar to the following form:
```rust
{ // origin:
if let Some(file_descriptor) = this.machine.fds.get_mut(fd) {
// write file_descriptor
this.try_unwrap_io_result(result)
} else {
this.fd_not_found()
}
}
{ // now:
let Some(mut file_descriptor) = this.machine.fds.get_mut(fd) else {
return this.fd_not_found();
};
// write file_descriptor
drop(file_descriptor);
this.try_unwrap_io_result(result)
}
```
The origin form can't compile because as using `RefCell` to get interior mutability, `fn get_mut` return `Option<std::cell::RefMut<'_, dyn FileDescription>>` instead of `Option<&mut dyn FileDescription>` now, and the `deref_mut` on `file_descriptor: RefMut` will cause borrow `this` as mutable more than once at a time.
So this form of refactors and manual drops are are implemented to avoid borrowing `this` at the same time.
make many-seeds a mode of ./miri run rather than a separate command
Also parallelize it so we use all cores to try seeds at the same time.
Fixes https://github.com/rust-lang/miri/issues/3509 by not alternating between different build modes (with/without dev-dependencies) all the time.
Rollup of 6 pull requests
Successful merges:
- #124461 (handle the targets that are missing in stage0)
- #124492 (Generalize `adjust_from_tcx` for `Allocation`)
- #124588 (Use `ObligationCtxt` in favor of `TraitEngine` in many more places)
- #124612 (Add support for inputing via stdin with run-make-support)
- #124613 (Allow fmt to run on rmake.rs test files)
- #124649 (Fix HorizonOS build broken by #124210)
r? `@ghost`
`@rustbot` modify labels: rollup
Fix HorizonOS build broken by #124210
HorizonOS (for the Tier-3 target `armv6k-nintendo-3ds`) does not support `dirfd()`, as many other similar targets.
Allow fmt to run on rmake.rs test files
As discussed with `@jieyouxu,` `rmake.rs` from the `run-make` testsuite would benefit from being formatted as well.
Only thing needed to be done for it to work: allow support for `!` in our `rustfmt.toml` file parsing.
r? `@onur-ozkan`