Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "3"
members = ["crates/faulx", "crates/procedre", "crates/helpers"]
members = ["crates/faulx", "crates/procedre", "crates/helpers", "crates/fuser"]

[workspace.package]
authors = ["martabal"]
Expand All @@ -24,6 +24,11 @@ nix = { version = "0.30.1", default-features = false, features = [
] }
orx-parallel = { version = "3.4.0", default-features = false }
rayon = { version = "1.11.0", default-features = false }
regex = { version = "1.11", default-features = false, features = [
"std",
"perf",
"unicode-case",
] }

[profile.release]
opt-level = 3
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

Implementation of psmisc utilities in rust. This is an early WIP.

WIP:
Implemented:

- faulx (killall implementation)
- procedre (pstree implementation)
- fuser (identify processes using files/sockets)

TODO:

- fuser
- prstat
- pslog
- peekfd
2 changes: 2 additions & 0 deletions crates/faulx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ workspace = true
default = ["orx-parallel"]
rayon = ["dep:rayon"]
orx-parallel = ["dep:orx-parallel"]
regex = ["dep:regex"]

[dependencies]
clap.workspace = true
Expand All @@ -26,3 +27,4 @@ humantime.workspace = true
nix.workspace = true
orx-parallel = { workspace = true, optional = true }
rayon = { workspace = true, optional = true }
regex = { workspace = true, optional = true }
3 changes: 0 additions & 3 deletions crates/faulx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@ options implemented:
- interactive mode
- ignore case
- kill process running as user

TODO:

- regexp
- processes in the same namespace
9 changes: 9 additions & 0 deletions crates/faulx/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,13 @@ pub struct FaulxArgs {
/// Report if the signal was successfully sent
#[arg(long)]
pub verbose: bool,

/// Interpret process_names as an extended regular expression
#[cfg(feature = "regex")]
#[arg(short = 'r', long)]
pub regexp: bool,

/// Match processes that belong to the same namespaces as PID
#[arg(short = 'n', long)]
pub namespace: Option<String>,
}
1 change: 0 additions & 1 deletion crates/faulx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use nix::unistd::{User, setuid};

pub mod cli;
pub mod processes;
pub mod signals;

#[cfg(all(feature = "rayon", feature = "orx-parallel"))]
compile_error!("feature \"rayon\" and feature \"oxc-parallel\" cannot be enabled at the same time");
Expand Down
6 changes: 4 additions & 2 deletions crates/faulx/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
};

use clap::Parser;
use helpers::{macros::QUIET, qprintln};
use helpers::{list_signals, macros::QUIET, parse_signal, qprintln};
use nix::{
sys::signal::{Signal, kill},
unistd::Pid,
Expand All @@ -15,7 +15,6 @@ use faulx::{
change_user,
cli::{FaulxArgs, MAX_NAMES},
processes::{OptionsPids, list_pids},
signals::{list_signals, parse_signal},
};

fn main() {
Expand Down Expand Up @@ -55,6 +54,9 @@ fn main() {
younger_than: args.younger_than,
older_than: args.older_than,
ignore_case: args.ignore_case,
#[cfg(feature = "regex")]
regexp: args.regexp,
namespace: args.namespace.as_deref(),
};
let pids = match list_pids(process_name, &opts) {
Ok(pids) => pids,
Expand Down
Loading