procutils_common/lib.rs
1//! Shared utilities used by the `procutils` workspace.
2//!
3//! This crate is a support library, not an end-user tool — it exists
4//! to keep parsing, matching, and formatting logic in one place across
5//! the procutils binaries. Each module is small and self-contained:
6//!
7//! - [`fmt`]: human-readable size formatters (`K`/`M`/`G`/`T`).
8//! - [`man`]: per-tool man-page content shared with the man-page generator.
9//! - [`procmatch`]: process selection logic shared by `pgrep`, `pkill`,
10//! `skill`, `snice` — regex matching plus filters on PID, UID,
11//! parent, session, tty, run-state, environment, and more.
12//! - [`signal`]: canonical signal-number/name table and `parse_signal`
13//! used by `kill`, `pkill`, `skill`.
14//! - [`uid`]: UID-to-username lookups backed by `/etc/passwd`, with a
15//! small per-process cache.
16//! - [`utmp`]: reader for the `utmp(5)` binary file format used by
17//! `/var/run/utmp`. The on-disk stride is computed from `libc::utmpx`
18//! so the parser stays correct across glibc architectures.
19//!
20//! The API is **not stable** and may change without notice between
21//! releases. This crate is intended for internal use by the procutils
22//! workspace only.
23
24pub mod fmt;
25pub mod man;
26pub mod procmatch;
27pub mod signal;
28pub mod uid;
29pub mod utmp;
30
31/// Default maximum width for help-text wrapping in clap-derived CLIs.
32///
33/// 100 columns matches what most tools in the workspace use; setting it
34/// here keeps clap output consistent across all 18 binaries.
35pub const MAX_TERM_WIDTH: usize = 100;