diff --git a/recipes/wip/rs/uutils-procps/recipe.toml b/recipes/wip/rs/uutils-procps/recipe.toml index 9fc042cc..caf04ab1 100644 --- a/recipes/wip/rs/uutils-procps/recipe.toml +++ b/recipes/wip/rs/uutils-procps/recipe.toml @@ -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" +""" diff --git a/recipes/wip/rs/uutils-procps/redox.patch b/recipes/wip/rs/uutils-procps/redox.patch new file mode 100644 index 00000000..d7435bde --- /dev/null +++ b/recipes/wip/rs/uutils-procps/redox.patch @@ -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 { + } + } + ++#[cfg(target_os = "redox")] ++fn getsid(_pid: i32) -> Option { ++ None ++} ++ + // TODO: Temporary add to this file, this function will add to uucore. + #[cfg(target_family = "windows")] + fn getsid(_pid: i32) -> Option {