From b1f0ce01fb6ece8628cf0499690a003cdac28f7f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 14 Feb 2026 17:29:08 +0200 Subject: Remove macOS stats gathering support, require Linux with /proc Remove non-functional macOS monitoring code that used native tools (sysctl, vm_stat, netstat, iostat). Now loadbars exits with an error when attempting local stats gathering on non-Linux systems. macOS can still be used as a client to monitor remote Linux servers via SSH. --- AGENTS.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'AGENTS.md') diff --git a/AGENTS.md b/AGENTS.md index 63531fd..ab005e5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -66,33 +66,27 @@ Network interface: chosen by `netint` config or first non-`lo`; press `n` to cyc - `go test ./...` or `mage test`. No UI tests; collector has parse tests for protocol (e.g. `ParseNetLine` for Linux-style `/proc/net/dev` output). -## macOS support +## macOS support (client only) -Loadbars supports macOS with automatic window activation and OS-specific monitoring scripts. +Loadbars supports macOS as a client to monitor remote Linux servers via SSH. ### Implementation details -- **Script embedding:** Both Linux and Darwin monitoring scripts are embedded in the binary -- **OS detection:** Automatically uses the correct script based on the host: - - `localhost` on macOS → Darwin script (sysctl, vm_stat, netstat, iostat) - - `localhost` on Linux → Linux script (/proc filesystem) - - All remote hosts → Linux script (assumes remote servers are Linux) - **Window activation:** macOS-specific code automatically brings SDL window to foreground - Uses build tags (`activate_darwin.go` and `activate.go`) - No external helper script needed ### Key files -- `internal/collector/script.go` - Embeds both scripts -- `internal/collector/collector.go` - Selects script based on host (checks if `/proc` exists for localhost) +- `internal/collector/script.go` - Embeds the Linux monitoring script +- `internal/collector/collector.go` - Runs Linux script locally or over SSH; exits with error if local system lacks /proc - `internal/display/activate_darwin.go` - macOS-specific activation using `open -a` - `internal/display/activate.go` - No-op for other platforms ### Known limitations -- Remote macOS hosts are not supported (assumes all remote hosts are Linux) -- macOS script doesn't provide per-core CPU statistics (iostat limitation) -- Swap usage on macOS always shows 0 (macOS uses compressed memory differently) +- Local monitoring on macOS is not supported (requires Linux with /proc filesystem) +- All remote hosts must be Linux (assumes all remote hosts are Linux) ## Useful references -- cgit v1.2.3