// HTOPRS — ENGINEERING REPORT

Faithful port · htop 3.5.1 is the spec · function-for-function, cited File.c:line · build-time port-purity gate

Docs Port report

>_EXECUTIVE SUMMARY

htoprs is a faithful Rust port of htop 3.5.1, the interactive process viewer. The upstream C source is the specification — the port is translated function-for-function, never reimplemented from scratch, the same precedent as zshrs.

Fidelity is enforced mechanically: a build-time port-purity gate rejects any free fn under src/ported/ whose name has no counterpart in the htop C source. The port now covers 130 of the 131 C files1069 of 1093 C functions (97.8%), with 1 remaining stub. On top of the port sits an htoprs-original extensions layer (18 modules, exempt from the port-purity gate) providing a named color-theme system, a keyboard-help/theme overlay, and a live monitoring suite (per-PID history rings, threshold alerts, braille CPU graphs, a fuzzy finder, snapshot diffs, and exporters). Live coverage per file is in the port report.

v0.5.7
Version
3.5.1
htop spec
131
C source files
1093
C fns defined
1069
Fns ported
97.8%
Coverage
163
src .rs files
88.9k
Source lines

~PORTING METHODOLOGY

The C source is the spec. Ports are faithful; the original C is translated function-for-function. The gate keeps the port from drifting into a reimplementation.

LayerImplementation
Spechtop 3.5.1 at ~/forkedRepos/htop — 131 .c files, platform-split (darwin / linux / freebsd / netbsd / openbsd / dragonflybsd / solaris / pcp)
Port treesrc/ported/<file>.rs, one Rust module per C file; every fn carries a /// Port of citation naming its <File>.c:<line> origin
Port-purity gatebuild.rs (std-only) scans src/ported/ on every cargo build / test / check; a free fn whose name is absent from tests/data/htop_c_fn_names.txt and the allowlist 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 (HTOP_C_SOURCE=~/forkedRepos/htop) after pulling upstream htop
Allowlisttests/data/fake_fn_allowlist.txt — genuine Rust-only architectural helpers only, each justified inline; currently empty
Port reportscripts/gen_port_report.pyport_report.html, per-file + overall coverage derived from source at run time (nothing hardcoded)

&PORTED SUBSYSTEMS

130 of the 131 C files are started (97.8% of functions). The authoritative per-file, per-function breakdown is the port report, generated from source; this table groups the port by subsystem.

SubsystemPorted layer
Core modelProcess / ProcessTable / Table / Row / Machine / Object / Settings — the process model, table build, and settings
Containers & utilsVector, Hashtable, RichString, XUtils — sort/search, prime-table, attributed strings, string/math helpers
MetersMeter plus CPU / Memory / Swap / Load / Battery / Network / DiskIO / GPU / ZFS / DateTime / Uptime / Tasks / dynamic meters
UI panelsPanel / ScreenManager / MainPanel / FunctionBar / Header and the setup / columns / colors / display-options / affinity / signals panels
Screens & inputAction key dispatch, IncSet, LineEditor, and the trace / env / info / open-files / process-locks screens
ncurses shimCRT — the crossterm-backed terminal layer (colors, mouse, key decode)
Platformsdarwin / linux / freebsd / netbsd / openbsd / dragonflybsd / solaris machine & process-table backends

The C allocation / memory machinery (the xMalloc family, the raw Object** dynamic array, the open-addressing bucket table), the null-terminated-string helpers, and the varargs formatters have no faithful safe-Rust analog (Rust's Vec / HashMap / String own allocation, bounds, probing, and lifetimes) and are intentionally not ported. The remaining 1 stub and un-started files are tracked in the port report.


+HTOPRS-ORIGINAL EXTENSIONS

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

AreaCapability
Theming31 named color schemes with a live chooser / editor overlay (c / C), recoloring the ncurses UI in 256-color; persisted to ~/.config/htoprs/prefs.json
MonitoringPer-PID CPU/mem history rings, debounced threshold alerts (A), a fuzzy process finder (f), regex filters (r), snapshot diffs (d), and JSON/CSV export (o)
Braille graphsA full braille CPU history graph (G) and an inline per-process CPU graph whose height scales with load (v)
ChromeA themed help overlay (h/?), a border toggle (B), and a bar-fill-glyph cycler (b)

$CI GATES

GateCommand
port-puritycargo build (build.rs rejects any non-htop fn under src/ported/)
testcargo test — hand-crafted unit tests pin the C edge behavior
fmtcargo fmt --all --check

#PROJECT METADATA

ItemValue
Version0.5.0
LicenseGPL-2.0-or-later (matching htop)
Spechtop 3.5.1 — github.com/htop-dev/htop
Precedentzshrs — the faithful-port + port-purity-gate pattern
AuthorMenkeTechnologies
Repositorygithub.com/MenkeTechnologies/htoprs
Meta umbrellaMenkeTechnologiesMeta