remove renice: moved to https://github.com/uutils/bsdutils
This commit is contained in:
10
Cargo.lock
generated
10
Cargo.lock
generated
@@ -640,7 +640,6 @@ dependencies = [
|
||||
"textwrap",
|
||||
"uu_lscpu",
|
||||
"uu_mountpoint",
|
||||
"uu_renice",
|
||||
"uucore",
|
||||
"xattr",
|
||||
]
|
||||
@@ -663,15 +662,6 @@ dependencies = [
|
||||
"uucore",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uu_renice"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"libc",
|
||||
"uucore",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uucore"
|
||||
version = "0.0.24"
|
||||
|
@@ -25,7 +25,6 @@ build = "build.rs"
|
||||
default = ["feat_common_core"]
|
||||
|
||||
feat_common_core = [
|
||||
"renice",
|
||||
"mountpoint",
|
||||
"lscpu",
|
||||
]
|
||||
@@ -56,7 +55,6 @@ textwrap = { workspace = true }
|
||||
|
||||
#
|
||||
lscpu = { optional = true, version = "0.0.1", package = "uu_lscpu", path = "src/uu/lscpu" }
|
||||
renice = { optional = true, version = "0.0.1", package = "uu_renice", path = "src/uu/renice" }
|
||||
mountpoint = { optional = true, version = "0.0.1", package = "uu_mountpoint", path = "src/uu/mountpoint" }
|
||||
|
||||
[dev-dependencies]
|
||||
|
@@ -1,18 +0,0 @@
|
||||
[package]
|
||||
name = "uu_renice"
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
libc = { workspace = true }
|
||||
uucore = { workspace = true }
|
||||
clap = { workspace = true }
|
||||
|
||||
[lib]
|
||||
path = "src/renice.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "renice"
|
||||
path = "src/main.rs"
|
@@ -1,7 +0,0 @@
|
||||
# renice
|
||||
|
||||
```
|
||||
renice [--priority|--relative] priority [-g|-p|-u] identifier...
|
||||
```
|
||||
|
||||
Alter priority of running processes
|
@@ -1 +0,0 @@
|
||||
uucore::bin!(uu_renice);
|
@@ -1,58 +0,0 @@
|
||||
// This file is part of the uutils util-linux package.
|
||||
//
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
use libc::PRIO_PROCESS;
|
||||
use std::env;
|
||||
use std::io::Error;
|
||||
use std::process;
|
||||
use uucore::{error::UResult, format_usage, help_about, help_usage};
|
||||
const ABOUT: &str = help_about!("renice.md");
|
||||
const USAGE: &str = help_usage!("renice.md");
|
||||
use clap::{crate_version, Arg, Command};
|
||||
|
||||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let matches = uu_app().try_get_matches_from(args)?;
|
||||
|
||||
let nice_value = *matches.get_one::<i32>("nice_value").unwrap_or_else(|| {
|
||||
eprintln!("Invalid nice value");
|
||||
process::exit(1);
|
||||
});
|
||||
|
||||
let pid = *matches.get_one::<i32>("pid").unwrap_or_else(|| {
|
||||
eprintln!("Invalid PID");
|
||||
process::exit(1);
|
||||
});
|
||||
|
||||
if unsafe { libc::setpriority(PRIO_PROCESS, pid.try_into().unwrap(), nice_value) } == -1 {
|
||||
eprintln!("Failed to set nice value: {}", Error::last_os_error());
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
println!("Nice value of process {} set to {}", pid, nice_value);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new("nice_value")
|
||||
.value_name("NICE_VALUE")
|
||||
.help("The new nice value for the process")
|
||||
.required(true)
|
||||
.index(1),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("pid")
|
||||
.value_name("PID")
|
||||
.help("The PID of the process")
|
||||
.required(true)
|
||||
.index(2),
|
||||
)
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
// This file is part of the uutils util-linux package.
|
||||
//
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
// spell-checker:ignore (words) symdir somefakedir
|
||||
|
||||
use crate::common::util::{TestScenario, UCommand};
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
@@ -12,7 +12,3 @@ mod test_lscpu;
|
||||
#[cfg(feature = "mountpoint")]
|
||||
#[path = "by-util/test_mountpoint.rs"]
|
||||
mod test_mountpoint;
|
||||
|
||||
#[cfg(feature = "renice")]
|
||||
#[path = "by-util/test_renice.rs"]
|
||||
mod test_renice;
|
||||
|
Reference in New Issue
Block a user