// HTOPRS — A FAITHFUL RUST PORT OF HTOP

faithful port · htop 3.5.1 is the spec · C source at ~/forkedRepos/htop · function-for-function, cited File.c:line · build-time port-purity gate

Report Port report GitHub

>_HTOPRS

The htop C source is the spec. htoprs is a faithful Rust port of htop, the interactive process viewer. The upstream C is translated function-for-function, never reimplemented from scratch. Every function under src/ported/ ports a specific htop C function and cites its origin (<File>.c:<line>) in its doc comment.

Porting methodology

Spechtop 3.5.1 at ~/forkedRepos/htop (131 .c files, platform-split darwin / linux / freebsd / …)
Port treesrc/ported/<file>.rs — one Rust module per C file; each fn cites /// Port of its <File>.c:<line> origin
Port-purity gatebuild.rs checks every free fn name under src/ported/ against the htop C-function snapshot; a name with no C counterpart fails the build. Cannot be bypassed by cargo test --test X
C-name snapshottests/data/htop_c_fn_names.txt, regenerated by tests/data/extract_c_fn_names.sh after pulling upstream htop
Allowlisttests/data/fake_fn_allowlist.txt — genuine Rust-only architectural helpers only, each justified
Port reportscripts/gen_port_report.pyport_report.html, per-file + overall coverage derived from source at run time

Ported so far — 891 / 1093 C functions (81.5%)

121 of htop's 131 C files are started; 31 stubs remain. The authoritative per-file, per-function breakdown is the port report, generated from source. By subsystem:

Core modelProcess / ProcessTable / Table / Row / Machine / Object / Settings
Containers & utilsVector, Hashtable, RichString, XUtils
MetersMeter + CPU / Memory / Swap / Load / Battery / Network / DiskIO / GPU / ZFS / dynamic
UI panelsPanel / ScreenManager / MainPanel / FunctionBar / Header + setup panels
Screens & inputAction, IncSet, LineEditor, trace / env / open-files / process-locks screens
ncurses shimCRT — crossterm-backed colors, mouse, key decode
Platformsdarwin / linux / freebsd / netbsd / openbsd / dragonflybsd / solaris

htoprs-original extensions

On top of the faithful port, an src/extensions/ layer (18 modules, exempt from the port-purity gate) adds capabilities htop lacks — htoprs-original, not translations of htop C.

Theming31 named color schemes, live chooser / editor overlay (c / C), 256-color UI recolor, persisted to prefs
MonitoringPer-PID history rings, threshold alerts (A), fuzzy finder (f), regex filters (r), snapshot diffs (d), JSON/CSV export (o)
Braille graphsFull CPU history graph (G) and an inline per-process CPU graph whose height scales with load (v)
ChromeThemed help overlay (h/?), border toggle (B), bar-fill-glyph cycler (b)

Build & test

cargo build          # runs the port-purity gate
cargo test           # hand-crafted unit tests pin the C edge behavior
python3 scripts/gen_port_report.py   # regenerate docs/port_report.html

The snapshot is regenerated with HTOP_C_SOURCE=~/forkedRepos/htop tests/data/extract_c_fn_names.sh after pulling new upstream htop commits.

The MenkeTechnologies stack

htoprs follows the same faithful-port precedent as zshrs (the first compiled Unix shell, a 1:1 port of zsh's C). Browse the rest via the MenkeTechnologiesMeta umbrella repo.