code wiki / (root) / nx_vsz_watchdog.nx

nx_vsz_watchdog.nx

buildroot/runtime/nx_vsz_watchdog.nx

7974 B179 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic vsz
docsdependenciesstructsconstsfunctions

about

nx_vsz_watchdog.nx -- ONE-SHOT VSZ watchdog CLI (cron/piggyback-invoked): kills a conf-listed daemon whose VSZ crossed its threshold so the nx_hostctl guard respawns it FRESH -- automating the proven manual fix for outage MODE 2 (VSZ-bloat -> fork-fail -> child-exec silently empty; mgmt hit 160GB, restart -> 4.2GB and the exact failed /api/unpack succeeded). DEATH-DECIDER ONLY: respawn is the guard's (no dueling supervisors). usage: nx_vsz_watchdog [conf] [dry] conf default "vsz_watchdog.conf" rows: <cmdline-needle> <max_gb> FAIL-SAFE: no conf -> INERT exit 0; parse failure -> row dropped; unreadable status -> skip; cooldown 600s per row; never kills pid<=300 or itself. Always exits 0 (a watchdog must never fail the cron). license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_vsz_watchdog_core.nx nx_vsz_watchdog.nx

imports: nx_syscalls.nxnx_vsz_watchdog_core.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main w_streq sys_mmap vw_read sys_openat_rd sys_read sys_close w_puts sys_write vw_parse_row sys_mmap ↻ vw_num_at sys_munmap vw_selfpid sys_mmap ↻ vw_read ↻ sys_munmap ↻ vw_num_at ↻ vw_now_s sys_mmap ↻ sys_clock_gettime_mono sys_openat_rd ↻ sys_getdents64 dirent_reclen dirent_name vw_num_at ↻ vw_slen vw_contains vw_vmsize_kb_of vw_status_kb_of sys_mmap ↻ vw_read ↻ sys_munmap ↻ vw_status_kb vw_slen ↻ sys_mmap ↻ vw_num_at ↻ sys_munmap ↻ w_cd_read sys_mmap ↻

structs

none

consts

11const K_MAGIC_8192: i64 = 8192
12const K_MAGIC_8191: i64 = 8191
13const K_MAGIC_65536: i64 = 65536

functions

15func w_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main calls 1: sys_write
16func w_putn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
26func w_streq(a: *u8, b: *u8) -> i64
called by 1: main
33func w_cd_path(idx: i64, out: *u8) -> i64
called by 2: w_cd_readw_cd_write
45func w_cd_read(idx: i64) -> i64
56func w_cd_write(idx: i64, now: i64) -> i64
75func main(argc: i64, argv: *i64) -> i64