nx_sweep_daemon.nx
buildroot/runtime/nx_sweep_daemon.nx
about
nx_sweep_daemon.nx -- STANDING SWEEP daemon, CLI half (tools/ops surface). Runs the data-driven check
registry on an interval, NEVER hanging (each check is deadline-killed by nx_sweep_core), serves a
PLAIN-ENGLISH /status page, and dedups alerts (one line on the 0->1 red transition, silent while it
stays red -- captured to the supervisor log via stdout). Supervised by nx_daemon_supervisor (a
daemons.reg row, revive-armed) so it never silently dies. Verbs:
once [reg] run every check once, print verdicts, exit 0 iff all PASS (gate/manual/CI)
serve <port> [reg] bind :port, sweep every interval, serve /status (the standing daemon)
Default registry: knowledge/sweep_checks.reg. license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_sweep_daemon_lib.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 11 | const SV_ARG_VERB: i64 = 1 |
| 12 | const SV_ARG_PORT: i64 = 2 // serve: port |
| 13 | const SV_ARG_SREG: i64 = 3 // serve: optional registry |
| 14 | const SV_ARG_IVMS: i64 = 4 // serve: optional interval ms (default SV_INTERVAL_MS) |
| 15 | const SV_ARG_OREG: i64 = 2 // once: optional registry |
| 16 | const SV_ARGC_SERVE: i64 = 3 // serve port |
| 17 | const SV_RC_USAGE: i64 = 2 |
| 18 | const SV_INTERVAL_MS: i64 = 300000 // 5 min between sweeps (a threshold -> named, rule 11) |
| 22 | const SV_SHM_SZ: i64 = 262144 // shared snapshot page (holds the rendered status HTML) |
| 23 | const SV_SEQ_I: i64 = 0 // seqlock counter (i64 index into shm) |
| 24 | const SV_BLEN_I: i64 = 1 // published body length (i64 index) |
| 25 | const SV_BODY_OFF: i64 = 16 // body bytes begin after the two i64 header slots |
| 26 | const SV_SEQ_TRIES: i64 = 100000 // seqlock read retry cap (writer-starvation backstop) |
| 27 | const SV_RESP_EXTRA: i64 = 256 // HTTP header headroom over the body |
| 28 | const SV_SEQ_MOD: i64 = 2 // seqlock parity: even=committed, odd=writer-active |
| 29 | const SV_RC_CHILD: i64 = 3 // status-child fatal-bind exit code |
| 30 | const SV_REQ_CAP: i64 = 8192 |
| 31 | const SV_AF_INET: i64 = 2 |
| 32 | const SV_SOCK_STREAM: i64 = 1 |
| 33 | const SV_SOL_SOCKET: i64 = 1 |
| 34 | const SV_SO_REUSEADDR: i64 = 2 |
| 35 | const SV_PTR1: i64 = 8 // single-i64 scratch |
| 36 | const SV_OPTLEN: i64 = 4 // setsockopt optlen (int) |
| 37 | const SV_SADDR_LEN: i64 = 16 |
| 38 | const SV_BACKLOG: i64 = 16 |
| 39 | const SV_PORT_HI_SH: i64 = 8 |
| 40 | const SV_BYTE: i64 = 0xFF |
| 41 | const SV_ADDR_FAM: i64 = 0 // sockaddr offset: family |
| 42 | const SV_ADDR_PORT: i64 = 2 // sockaddr offset: port (big-endian) |
| 43 | const SV_DEC: i64 = 10 |
| 44 | const SV_ASCII_0: i64 = 48 |
| 45 | const SV_ASCII_9: i64 = 57 |
functions
| 47 | func sv_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 48 | func sv_seq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 } called by 1: main |
| 49 | func sv_atoi(s: *u8) -> i64 called by 1: main |
| 55 | func sv_print_verdict(ctx: *i64, i: i64) -> i64 |
| 74 | func sv_alerts(ctx: *i64) -> i64 |
| 89 | func sv_http_wrap(resp: *u8, cap: i64, body: *u8, blen: i64, op: *i64) -> i64 |
| 101 | func sv_shm_write(shm: *u8, html: *u8, hl: i64) -> i64 called by 1: main |
| 113 | func sv_sockaddr(addr: *u8, port: i64) -> i64 called by 1: sv_status_child |
| 122 | func sv_status_child(shm: *u8, port: i64) -> i64 |
| 166 | func main(argc: i64, argv: *i64) -> i64 |