Conversation
|
By one PR? |
|
it is a draft, i want to verify first that it works |
|
I like to use raw lackend for perf as per as possible, but libc backend might needed for some GnuTests depending on |
Merging this PR will degrade performance by 4.23%
Performance Changes
Comparing Footnotes
|
|
|
Cargo.toml
Outdated
| rstest_reuse = "0.7.0" | ||
| rustc-hash = "2.1.1" | ||
| rust-ini = "0.21.0" | ||
| rustix = { version = "1.1.4", default-features = false } |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
This comment was marked as off-topic.
This comment was marked as off-topic.
|
Some failing/skipped GnuTests e.g. nfs-removal-race uses |
|
GNU testsuite comparison: |
62845d5 to
63dbbbb
Compare
Add collation_key_buffer (arena) and collation_key_ends (offsets) to LineData and RecycledChunk, with a collation_key() accessor. All sort keys for a chunk are stored in a single Vec<u8> to avoid millions of small heap allocations.
Add rustix 1.1.4 with default-features = false to prepare for migrating from nix to rustix for safer syscall bindings.
Replace all `nix::libc::*` usages with direct `libc::*` imports to decouple libc access from the nix crate, as preparation for migrating from nix to rustix. Add direct libc dependency to crates that previously relied on nix's libc re-export: stty, env, sort, date, mknod, touch.
Add a `csignal` module with thin libc-based wrappers for signal operations that rustix does not cover: signal(), sigaction(), sigprocmask(), SigSet, SigHandler, and SigmaskHow. These wrappers will replace nix's signal module as part of the nix-to-rustix migration. Also add libc as a non-optional unix dependency for uucore.
Replace nix pipe/splice/vmsplice wrappers with rustix equivalents
in uucore's pipes module. Also migrate cat's splice.rs to use
rustix::io::{read, write} instead of nix::unistd.
The return types change from nix::Result to std::io::Result, which
is more idiomatic and compatible with the broader ecosystem.
Replace nix process functions with rustix equivalents: - geteuid/getegid/getuid/getgid/getpid/getpgrp/getsid -> rustix::process - kill/test_kill -> rustix::process::kill_process/test_kill_process - Signal::try_from -> signal_from_raw helper using from_raw_unchecked - SigHandler for send_signal_group -> csignal wrapper The getsid return type changes from Result<pid_t, Errno> to io::Result<pid_t>, which is more idiomatic.
Replace all nix APIs with rustix equivalents in the security-critical
TOCTOU-safe filesystem traversal module:
- nix::dir::Dir -> rustix::fs::Dir (uses Dir::read_from which borrows fd)
- nix::fcntl::{OFlag, openat} -> rustix::fs::{OFlags, openat}
- nix::sys::stat::{fstat, fstatat, fchmod, fchmodat, mkdirat} -> rustix::fs
- nix::unistd::{fchown, fchownat, unlinkat} -> rustix::fs
- FchmodatFlags/UnlinkatFlags -> rustix::fs::AtFlags
- Error handling simplified: rustix Errno implements Into<io::Error>
Also update rm's unix platform code to use the new Stat type.
All 31 safe_traversal unit tests pass.
…ustix
- mode.rs: nix::sys::stat::{Mode, umask} -> rustix::process::umask, rustix::fs::Mode
- fs.rs: nix::sys::stat::{fstat, stat, lstat, FileStat} -> rustix::fs equivalents
- buf_copy/linux.rs: nix::unistd::{read, write} -> rustix::io::{read, write},
nix::Error -> rustix::io::Errno
Replace all nix signal and poll APIs in uucore: - signals.rs: nix::sys::signal -> csignal wrappers - signals.rs: nix::poll -> rustix::event::poll - signals.rs: nix::sys::stat -> rustix::fs::fstat + libc constants - lib.rs: nix sigaction -> csignal::set_signal_action - dd/progress.rs: update install_sigusr1_handler to use libc::SIGUSR1 Return types change from nix::Result/Errno to std::io::Result.
789a64f to
be64e4a
Compare
Migrate 19 utility crates from nix to rustix and direct libc calls: - kill, timeout, env: signal handling via csignal wrappers + libc - sync, cat, tail, dd, tsort: file operations via rustix::fs - touch: futimens via rustix::fs::futimens - stty, tty: terminal ops via rustix::termios + libc ioctl - sort: getrlimit via rustix::process, sysconf via libc - wc, cp, df: stat/fstat via rustix::fs - nice: priority via rustix::process - mkfifo, mknod: via direct libc calls Also add rustix::io::Errno conversions to uucore error.rs.
- Remove nix dependency from uucore Cargo.toml - Remove nix error conversion impls from error.rs, replace with rustix - Migrate date's clock_settime/clock_getres from nix to rustix::time - Replace nix dependency with rustix in date's Cargo.toml - Update test nix features for test utilities that still need it The nix crate is now completely removed from all source code (src/). It remains only as a dev-dependency for test code.
Replace the single unsafe libc::kill() call with safe rustix equivalents: kill_process, kill_process_group, kill_current_process_group, and their test_kill_* variants for signal 0.
Replace unsafe libc::mknod() with safe rustix::fs::mknodat(CWD, ...) and unsafe libc::umask() with safe rustix::process::umask().
Without use-libc, rustix uses direct inline assembly syscalls, bypassing glibc entirely. On a glibc-based system like Debian, this can break LD_PRELOAD interposition, sanitizers, and miss glibc optimizations like the getpid() cache.
|
GNU testsuite comparison: |
|
splice() It might changed if we 100 removed |
No description provided.