Fix and port more apps for uutils-procps

This commit is contained in:
Wildan M 2026-05-25 11:11:24 +02:00
parent 5676d5f763
commit 0c7353bfad
2 changed files with 61 additions and 5 deletions

View File

@ -1,22 +1,41 @@
#TODO: common libc functions such as getsid
#TODO: only watch is working
#TODO: common libc functions such as getsid and utmpx in rustix
[source]
git = "https://github.com/uutils/procps"
rev = "ee98c0a78fe2abe72589f80eb05b455fa228e757"
patches = [ "redox.patch" ]
shallow_clone = true
[build]
template = "custom"
script = """
DYNAMIC_INIT
# TODO: more features support?
CARGO_PROFILE_RELEASE_LTO=thin cookbook_cargo --no-default-features --features pmap,slabtop,sysctl,tload,vmstat,watch
BINS=(
#free
hugetop
pgrep
pidof
pidwait
pkill
pmap
ps
pwdx
skill
snice
sysctl
tload
#top
vmstat
#w
watch
)
(IFS=,; CARGO_PROFILE_RELEASE_LTO=thin cookbook_cargo --no-default-features --features "${BINS[*]}")
for bin in "${BINS[@]}"
do
ln -sv procps "${COOKBOOK_STAGE}/usr/bin/$bin"
done
"""
# conflict with coreutils
rm "${COOKBOOK_STAGE}/usr/bin/ps"
"""

View File

@ -0,0 +1,37 @@
diff --git a/src/uu/pgrep/src/process_matcher.rs b/src/uu/pgrep/src/process_matcher.rs
index c991092..33adcff 100644
--- a/src/uu/pgrep/src/process_matcher.rs
+++ b/src/uu/pgrep/src/process_matcher.rs
@@ -452,14 +452,14 @@ pub fn getpgrp() -> u64 {
/// Dummy implementation for unsupported platforms.
pub fn getsid(_pid: u32) -> u64 {
- #[cfg(unix)]
+ #[cfg(all(unix, not(target_os = "redox")))]
{
rustix::process::getsid(None)
.ok()
.map(|pid: rustix::process::Pid| pid.as_raw_nonzero().get() as u64)
.unwrap_or(0)
}
- #[cfg(not(unix))]
+ #[cfg(not(all(unix, not(target_os = "redox"))))]
{
0
}
diff --git a/src/uu/ps/src/process_selection.rs b/src/uu/ps/src/process_selection.rs
index c2a0a5a..65c33a2 100644
--- a/src/uu/ps/src/process_selection.rs
+++ b/src/uu/ps/src/process_selection.rs
@@ -20,6 +20,11 @@ fn getsid(pid: i32) -> Option<i32> {
}
}
+#[cfg(target_os = "redox")]
+fn getsid(_pid: i32) -> Option<i32> {
+ None
+}
+
// TODO: Temporary add to this file, this function will add to uucore.
#[cfg(target_family = "windows")]
fn getsid(_pid: i32) -> Option<i32> {