code wiki / _hdl_build / nx_hostctl.nx

nx_hostctl.nx

buildroot/runtime/_hdl_build/nx_hostctl.nx

262144 B3789 linesdepth 6pulls 10 transitivereach 1 importersview sourcekind librarytopic hostctl
docsdependenciesstructsconstsfunctions

about

nx_hostctl.nx -- the PURE-NISHI host control plane (operator: "no .sh or any non nishi stuff in the mix... pure enterprise S-class hosting and deployment"). Retires nishi_supervisor.sh. Two subcommands, argv-driven, all via sovereign syscalls -- NO shell, NO cp/mv/pkill: supervise : fork/execve the sites daemon, record its PID, wait4; respawn on death (crash OR deploy-kill). deploy : atomically publish the staged *.new artifacts (sys_renameat), +x the new binary (nx_chmod), then nx_kill the running daemon -> supervise respawns the NEW binary. Brief restart only (FD-passing/SCM_RIGHTS is the future zero-downtime rung). CONTENT hot-update needs NO deploy: the router serves the doc-root file per request, so pushing index.html is live next request. selftest : LOCAL Engineer gate of the deploy primitives (atomic rename + pidfile + kill) -- no NAS. license_tier: ORIGINAL SUPERVISION UPGRADE 2026-06-16 (closes hosting_research gaps #5 health-probe + #4 restart-loop-guard): cmd_supervise no longer trusts PID-liveness alone. For PLAINTEXT daemons it BLACK-BOX health-probes the port (nx_health_probe) and restarts a HUNG daemon (process up + bound but not serving) -- the failure systemd PID-liveness and a LISTEN check both miss. Every restart (crash OR hang) is gated by the crash-loop guard (nx_restart_guard) so a daemon that keeps dying/wedging backs off instead of spinning. The TLS daemon (sites.elf:8443) stays PID-only -- a plaintext GET to a TLS port would false-HUNG; a TLS-aware serving probe is the next rung (noted, not faked).

dependencies 7 imports · 1 importers

nx_syscalls.nx nx_connect.nx nx_health_probe.nx nx_restart_guard.nx nx_os_introspect.nx nx_fd_hygiene.nx nx_proc_snapshot.nx nx_hostctl.nx nx_hostctl_supervise_gate.nx

imports: nx_syscalls.nxnx_connect.nxnx_health_probe.nxnx_restart_guard.nxnx_os_introspect.nxnx_fd_hygiene.nxnx_proc_snapshot.nx

imported by: nx_hostctl_supervise_gate.nx

structs

none

consts

29const HC_CRAWL_STALE_S: i64 = 600
30const HC_MAGIC_65536: i64 = 65536
31const HC_MAGIC_8192: i64 = 8192
32const HC_MAGIC_60000: i64 = 60000
33const HC_MAGIC_300000: i64 = 300000
34const HC_MAGIC_8791: i64 = 8791
35const HC_MAGIC_5000: i64 = 5000
36const HC_MAGIC_5000000: i64 = 5000000
37const HC_MAGIC_300000000: i64 = 300000000
38const HC_MAGIC_4096: i64 = 4096
39const HC_MAGIC_8443: i64 = 8443
40const HC_MAGIC_18791: i64 = 18791
41const HC_MAGIC_18190: i64 = 18190
42const HC_MAGIC_18090: i64 = 18090
43const HC_MAGIC_8080: i64 = 8080
44const HC_MAGIC_18793: i64 = 18793
45const HC_MAGIC_18098: i64 = 18098
46const HC_MAGIC_18456: i64 = 18456
47const HC_MAGIC_8456: i64 = 8456
48const HC_MAGIC_15274: i64 = 15274
49const HC_MAGIC_18465: i64 = 18465
50const HC_MAGIC_18466: i64 = 18466
51const HC_MAGIC_8446: i64 = 8446
52const HC_MAGIC_18096: i64 = 18096
53const HC_MAGIC_16384: i64 = 16384
54const HC_MAGIC_7443: i64 = 7443
55const HC_MAGIC_18792: i64 = 18792
56const HC_MAGIC_9091: i64 = 9091
57const HC_MAGIC_8097: i64 = 8097
58const HC_MAGIC_18795: i64 = 18795
59const HC_MAGIC_18794: i64 = 18794
60const HC_MAGIC_18796: i64 = 18796
61const HC_MAGIC_18797: i64 = 18797
62const HC_MAGIC_18099: i64 = 18099
63const HC_MAGIC_18097: i64 = 18097
64const HC_MAGIC_18120: i64 = 18120
65const HC_MAGIC_7702: i64 = 7702
66const HC_MAGIC_6881: i64 = 6881
67const HC_MAGIC_8445: i64 = 8445
68const HC_MAGIC_8027: i64 = 8027
69const HC_MAGIC_8028: i64 = 8028
70const HC_MAGIC_8102: i64 = 8102
71const HC_MAGIC_8029: i64 = 8029
72const HC_MAGIC_8055: i64 = 8055
73const HC_MAGIC_8447: i64 = 8447
74const HC_MAGIC_1195: i64 = 1195
75const HC_MAGIC_5080: i64 = 5080
76const HC_MAGIC_15000: i64 = 15000
77const HC_MAGIC_1500: i64 = 1500
78const HC_MAGIC_2500: i64 = 2500
79const HC_MAGIC_4000: i64 = 4000
80const HC_MAGIC_1200: i64 = 1200
81const HC_MAGIC_2000: i64 = 2000
82const HC_MAGIC_131072: i64 = 131072
83const HC_MAGIC_3600000: i64 = 3600000
84const HC_MAGIC_262144: i64 = 262144
85const HC_MAGIC_2048: i64 = 2048
86const HC_MAGIC_40302: i64 = 40302
87const HC_MAGIC_1048576: i64 = 1048576
88const HC_MAGIC_16000: i64 = 16000
89const HC_MAGIC_16777232: i64 = 16777232
90const HC_MAGIC_16777216: i64 = 16777216
91const HC_MAGIC_90000: i64 = 90000
92const HC_MAGIC_1024: i64 = 1024
93const HC_MAGIC_65535: i64 = 65535
94const HC_MAGIC_8191: i64 = 8191
95const HC_MAGIC_2026: i64 = 2026
96const HC_MAGIC_25000: i64 = 25000
97const HC_MAGIC_86400000: i64 = 86400000
98const HC_MAGIC_3000: i64 = 3000
99const HC_MAGIC_6000: i64 = 6000
101const HC_ELF: *u8 = "/volume1/homes/elderwesto/nishihost/sites.elf" as *u8
102const HC_ELF_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/sites.elf.new" as *u8
103const HC_ELF_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/sites.elf.prev" as *u8 // rollback copy (never-brick)
104const HC_REDIRECT: *u8 = "/volume1/homes/elderwesto/nishihost/redirect.elf" as *u8
105const HC_VROOM: *u8 = "/volume1/homes/elderwesto/nishihost/nx_vroom_daemon.elf" as *u8
106const HC_SNIROUTER:*u8 = "/volume1/homes/elderwesto/nishihost/sni_router.elf" as *u8 // sovereign public-edge SNI router (:7443, TLS passthrough)
107const HC_XLATE: *u8 = "/volume1/homes/elderwesto/nishihost/nx_translate_daemon.elf" as *u8
108const HC_XLATE_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_translate_daemon.sov.elf.new" as *u8
109const HC_XLATE_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_translate_daemon.elf.prev" as *u8
110const HC_SIGKILL: i64 = 9
111const HC_CLOCK: *u8 = "/volume1/homes/elderwesto/nishihost/nx_clock_tickless.elf" as *u8 // the ONE consolidated scheduler (const, NOT an inline argv literal -- see the .nx gotcha note below)
112const HC_CONF: *u8 = "/volume1/homes/elderwesto/nishihost/sites.conf" as *u8
113const HC_CONF_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/sites.conf.new" as *u8
114const HC_DOCROOT: *u8 = "/volume1/homes/elderwesto/nishihost/sites/andelinwest" as *u8
115const HC_INDEX: *u8 = "/volume1/homes/elderwesto/nishihost/sites/andelinwest/index.html" as *u8
116const HC_INDEX_NEW:*u8 = "/volume1/homes/elderwesto/nishihost/andelinwest_index.html.new" as *u8
117const HC_PID: *u8 = "/volume1/homes/elderwesto/nishihost/sites.pid" as *u8
119const HC_CERT_LIVE: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_fullchain.der" as *u8
120const HC_CERT_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_fullchain.der.new" as *u8
121const HC_CERT_BAK: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_fullchain.der.bak" as *u8
122const HC_KEY_LIVE: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_ecdsa_key.bin" as *u8
123const HC_KEY_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_ecdsa_key.bin.new" as *u8
124const HC_KEY_BAK: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_ecdsa_key.bin.bak" as *u8
126const HC_READER: *u8 = "/volume1/homes/elderwesto/nishi-reader/nx_media_server_auth.elf" as *u8
127const HC_READER_DIR: *u8 = "/volume1/homes/elderwesto/nishi-reader" as *u8
128const HC_READER_KEYS: *u8 = "/volume1/homes/elderwesto/nishihost/auth/keys" as *u8
129const HC_READER_STORE:*u8 = "/volume1/homes/elderwesto/nishihost/auth/store" as *u8
132const HC_SELF: *u8 = "/volume1/homes/elderwesto/nishihost/nx_hostctl" as *u8
133const HC_SELF_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_hostctl.new" as *u8
137const HC_SELF_NEW_SOV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_hostctl.sov.elf.new" as *u8
138const HC_SELF_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_hostctl.prev" as *u8 // never-brick (#26): keep the old supervisor binary for rollback (selfswap had NONE)
139const HC_SUP_LOCK: *u8 = "/volume1/homes/elderwesto/nishihost/supervisor.heartbeat" as *u8 // single-supervisor lease: epoch heartbeat (getpid is BROKEN on this backend -> can't pid-exclude self)
143const HC_REALM: *u8 = "Nishi Wiki" as *u8
144const HC_PORT: *u8 = "8791" as *u8
145const HC_SUPERVISE: *u8 = "supervise" as *u8 // selfswap's re-exec argv[1] -- same const-not-inline-literal rule
146const HC_RUNSITE: *u8 = "runsite" as *u8 // startsite's hc_dfork_exec arg -> cmd_runsite execs sites.elf (sovereign, no sh -c)
151const HC_SLEEPER: *u8 = "sleeper" as *u8 // daemontest payload: a sovereign sleep loop (no OS /bin/sleep)
155const HC_RUNMIRROR: *u8 = "runmirror" as *u8
156const HC_MIRROR_BIN: *u8 = "/volume1/ai/apertus/nx_apertus_mirror_nas.elf" as *u8
159const HC_RUNMIRRORPAR: *u8 = "runmirrorpar" as *u8
160const HC_MIRRORPAR_BIN: *u8 = "/volume1/ai/apertus/nx_par_pull_nas.elf" as *u8
162const HC_DISTPUB_BIN: *u8 = "/volume1/ai/dist/nx_dist_publish_run.elf" as *u8
163const HC_RUNDISTPUB: *u8 = "rundistpub" as *u8
166const HC_DISTSERVE_BIN: *u8 = "/volume1/ai/dist/nx_dist_serve.elf" as *u8
167const HC_RUNDISTSERVE: *u8 = "rundistserve" as *u8
168const HC_RUNDISTPROBE: *u8 = "rundistprobe" as *u8
169const HC_A_SERVE: *u8 = "serve" as *u8
170const HC_A_PROBE: *u8 = "probe" as *u8
171const HC_A_PORT: *u8 = "18120" as *u8
172const HC_DIST_PROBE_PATH: *u8 = "/dist/509b6d9d22987cf7b1067a7cc6b74b88cf0c8c2739748fe5e85a4da0f69ebf1a/model.safetensors.index.json" as *u8
180const HC_SH: *u8 = "/bin/sh" as *u8
181const HC_DASHC: *u8 = "-c" as *u8
182const HC_READER_CMD: *u8 = "cd /volume1/homes/elderwesto/nishi-reader && exec ./nx_media_server_auth.elf /volume1/homes/elderwesto/nishihost/auth/keys /volume1/homes/elderwesto/nishihost/auth/store 'Nishi Wiki' 8791 >> auth.log 2>&1" as *u8
187const HC_GALX_GW: *u8 = "/volume1/ai/galx/nx_gallery_gateway.elf" as *u8
188const HC_GALX_GW_NEW: *u8 = "/volume1/ai/galx/nx_gallery_gateway.elf.new" as *u8
191const HC_GALX_GW_PREV: *u8 = "/volume1/ai/galx/nx_gallery_gateway.elf.prev" as *u8
192const HC_GALX_GW_SOVNEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_gallery_gateway.sov.elf.new" as *u8
193const HC_GALX_SERVE: *u8 = "/volume1/ai/galx/nx_gallery_serve.elf" as *u8
194const HC_GALX_SERVE_NEW: *u8 = "/volume1/ai/galx/nx_gallery_serve.elf.new" as *u8
195const HC_GALX_SERVE_CMD: *u8 = "cd /volume1/ai/galx && exec ./nx_gallery_serve.elf 18090 >>/tmp/galx_serve.log 2>&1" as *u8
201const HC_GALX_GW_CMD: *u8 = "cd /volume1/ai/galx && exec ./nx_gallery_gateway.elf 18190 knowledge/status/galx_gw_keys knowledge/status/galx_gw_store 1000000000 18090 0 65536 3 4 >>/tmp/galx_gw.log 2>&1" as *u8
204const HC_WIKI_GW: *u8 = "/volume1/ai/wiki/nx_wiki_gw.elf" as *u8
205const HC_WIKI_GW_NEW: *u8 = "/volume1/ai/wiki/nx_wiki_gw.elf.new" as *u8
206const HC_WIKI_GW_CMD: *u8 = "cd /volume1/ai/wiki && exec ./nx_wiki_gw.elf 18791 keys store 1000000000 65536 3 4 pages >>/tmp/wiki_gw.log 2>&1" as *u8
209const HC_HUB_GW: *u8 = "/volume1/ai/hub/nx_hub_gw.elf" as *u8
210const HC_HUB_GW_NEW: *u8 = "/volume1/ai/hub/nx_hub_gw.elf.new" as *u8
212const HC_RELATE: *u8 = "/volume1/homes/elderwesto/nishihost/nx_relate_daemon.elf" as *u8
213const HC_RELATE_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_relate_daemon.elf.new" as *u8
214const HC_RELATE_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_relate_daemon.elf.prev" as *u8
215const HC_RELATE_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && exec ./nx_relate_daemon.elf >>/tmp/relate_daemon.log 2>&1" as *u8
217const HC_CLEANSERVE: *u8 = "/volume1/homes/elderwesto/nishihost/nx_clean_serve_daemon.elf" as *u8
218const HC_CLEANSERVE_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_clean_serve_daemon.elf.new" as *u8
219const HC_DOCPORTAL: *u8 = "/volume1/homes/elderwesto/nishihost/nx_docportal_admin_daemon.elf" as *u8
220const HC_DOCPORTAL_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_docportal_admin_daemon.sov.elf.new" as *u8
221const HC_DOCPORTAL_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_docportal_admin_daemon.elf.prev" as *u8
222const HC_CLEANSERVE_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_clean_serve_daemon.elf.prev" as *u8
223const HC_CLEANSERVE_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && exec ./nx_clean_serve_daemon.elf 8102 >>/tmp/cleanserve.log 2>&1" as *u8
227const HC_MESH_SERVE_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && exec ./nx_mesh_serve.elf 8029 >>/tmp/mesh_serve.log 2>&1" as *u8
228const HC_MESH_GW_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && exec ./nx_mesh_gateway.elf 8055 meshgw_keys meshgw_store 100000 8029 0 65536 3 4 >>/tmp/mesh_gw.log 2>&1" as *u8
229const HC_PROJECT_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && exec ./nx_project_serve.elf 8028 opaque_keys.bin opaque_store.log 1000000000 knowledge/project/serve.conf nishi_uid_handle.tsv 19456 2 1 >>/tmp/project_gw.log 2>&1" as *u8
230const HC_HUB_GW_CMD: *u8 = "cd /volume1/ai/hub && exec ./nx_hub_gw.elf 18792 /volume1/homes/elderwesto/nishihost/opaque_keys.bin /volume1/homes/elderwesto/nishihost/opaque_store.log 1000000000 65536 3 4 >>/tmp/hub_gw.log 2>&1" as *u8
237const HC_MGMT_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && chmod +x ./nx_mgmt_api.elf 2>/dev/null; exec ./nx_mgmt_api.elf 18098 /volume1/homes/elderwesto/nishihost/opaque_keys.bin /volume1/homes/elderwesto/nishihost/opaque_store.log nishi_site_admin mgmt_snap.json 1000000000 >>/tmp/mgmt_api.log 2>&1" as *u8
246const HC_ADMIN_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && chmod +x ./nx_docportal_admin_daemon.elf 2>/dev/null; exec ./nx_docportal_admin_daemon.elf 18456 /volume1/homes/elderwesto/nishihost/andelinwest_docportal_keys /volume1/homes/elderwesto/nishihost/andelinwest_docportal_store andelinwest_docportal 20000000 >>/tmp/docportal_admin.log 2>&1" as *u8
247const HC_MAILPORTAL_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && chmod +x ./nx_email_portal_daemon.elf 2>/dev/null; exec ./nx_email_portal_daemon.elf 18465 /volume1/homes/elderwesto/nishihost/andelinwest_mail_keys /volume1/homes/elderwesto/nishihost/andelinwest_mail_store andelinwest_mail andelinwest.com /volume1/homes/elderwesto/nishihost/mail_aw/ 20000000 >>/tmp/mail_portal.log 2>&1" as *u8
248const HC_SITEEDIT_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && chmod +x ./nx_siteedit_daemon.elf 2>/dev/null; exec ./nx_siteedit_daemon.elf 18466 /volume1/homes/elderwesto/nishihost/andelinwest_docportal_keys /volume1/homes/elderwesto/nishihost/andelinwest_docportal_store andelinwest_docportal andelinwest.com /volume1/homes/elderwesto/nishihost/andelinwest.site /volume1/homes/elderwesto/nishihost/sites/andelinwest 20000000 >>/tmp/siteedit.log 2>&1" as *u8
253const HC_HEALTH_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && chmod +x ./nx_health_eval.elf 2>/dev/null; exec ./nx_health_eval.elf loop 300 >>/tmp/health_eval.log 2>&1" as *u8
257const HC_SIG2_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && chmod +x ./nx_signaling_v2.elf 2>/dev/null; exec ./nx_signaling_v2.elf >>/tmp/signaling_v2.log 2>&1" as *u8
262const HC_TORRENT_CMD: *u8 = "cd /volume1/ai/torrent && exec ./nx_media_env.sov.elf hub >>/tmp/torrentd.log 2>&1" as *u8
265const HC_TORRENT_GW_CMD: *u8 = "cd /volume1/ai/torrent && exec ./nx_torrent_gw.elf 18793 /volume1/homes/elderwesto/nishihost/opaque_keys.bin /volume1/homes/elderwesto/nishihost/opaque_store.log 1000000000 65536 3 4 >>/tmp/torrentgw.log 2>&1" as *u8
273const HC_GEN_GW_CMD: *u8 = "cd /volume1/ai/gen && exec ./nx_gen_gateway_daemon.elf 18794 /volume1/homes/elderwesto/nishihost/opaque_keys.bin /volume1/homes/elderwesto/nishihost/opaque_store.log 1000000000 18795 0 19456 2 1 86400 >>/tmp/gen_gw.log 2>&1" as *u8
274const HC_GEN_ORCH_CMD: *u8 = "cd /volume1/ai/gen && exec ./nx_gen_orchestrator_daemon.elf 18795 192 168 8 192 7861 /volume1/ai/gen/store- /volume1/ai/gen/blob- /volume1/ai/gen/cids.tsv laptop-5080 5000 >>/tmp/gen_orch.log 2>&1" as *u8
277const HC_SYNTH_CMD: *u8 = "cd /volume1/ai/synth && exec ./nx_synth_serve_daemon.elf 18796 >>/tmp/synth.log 2>&1" as *u8
280const HC_DEVAPI_CMD: *u8 = "cd /volume1/ai/devapi && chmod +x ./nx_dev_api_serve.elf ./_offc/*.elf 2>/dev/null; exec ./nx_dev_api_serve.elf serve 18797 >>/tmp/devapi.log 2>&1" as *u8
283const HC_LOGIN: *u8 = "/volume1/homes/elderwesto/nishihost/nx_opaque_login.elf" as *u8
284const HC_LOGIN_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_opaque_login.elf.new" as *u8
285const HC_LOGIN_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_opaque_login.elf.prev" as *u8
298const HC_LOGIN_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && exec ./nx_opaque_login.elf 9091 opaque_keys.bin opaque_store.log 1000000000 19456 2 1 /mnt/c/Users/elder/nishi-core/nxc2/knowledge/wiki_pages /volume1/homes/elderwesto/nishihost/nishi_hr.log >>/tmp/login.log 2>&1" as *u8
299const HC_LOGIN_TEST_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && exec ./nx_opaque_login.elf.new 9099 opaque_keys.bin opaque_store.log 50 19456 2 1 >>/tmp/logintest.out 2>&1" as *u8
303const HC_RUNMTLSPROXY: *u8 = "runmtlsproxy" as *u8
304const HC_MTLS_PROXY_BIN: *u8 = "/volume1/homes/elderwesto/nishihost/nx_aw_mtls_proxy.elf" as *u8
305const HC_MP_PORT: *u8 = "9444" as *u8
306const HC_MP_BACKEND: *u8 = "18791" as *u8
309const HC_RUNANDELIN: *u8 = "runandelin" as *u8
310const HC_ANDELIN_BIN: *u8 = "/volume1/homes/elderwesto/nishihost/nx_andelinwest_daemon.elf" as *u8
311const HC_RUNSNIR: *u8 = "runsnir" as *u8
312const HC_SNIR_BIN: *u8 = "/volume1/homes/elderwesto/nishihost/nx_sni_router.elf" as *u8
313const HC_SNIR_PORT: *u8 = "8444" as *u8
314const HC_SNIR_BACKEND: *u8 = "8443" as *u8
315const HC_NFTREAD_BIN: *u8 = "/volume1/homes/elderwesto/nishihost/nx_nft_read.elf" as *u8 // sovereign netfilter R0: read-only nat-table probe (grounds legacy-vs-nft)
316const HC_NETTAP_BIN: *u8 = "/volume1/homes/elderwesto/nishihost/nx_netscope_capture.elf" as *u8 // NX-NETSCOPE L-CAPTURE: the sovereign wire tap (AF_PACKET -> nx_packet_dissect)
321const HC_SITES_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && exec ./sites.elf >>/tmp/sites_run.log 2>&1" as *u8
327const HC_LIB_ELF: *u8 = "/volume1/homes/elderwesto/nishihost/lib/nx_lib_httpd.elf" as *u8
328const HC_LIB_ELF_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/lib/nx_lib_httpd.elf.new" as *u8
329const HC_LIB_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost/lib && exec ./nx_lib_httpd.elf >>/tmp/lib_run.log 2>&1" as *u8
332const HC_GENPROBE_CMD: *u8 = "exec /volume1/ai/gen/nx_gen_live_probe.elf >/volume1/ai/gen/genprobe.out 2>&1" as *u8
336const HC_TAPI_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && chmod +x ./nx_tools_api_serve.elf 2>/dev/null; mkdir -p knowledge 2>/dev/null; exec ./nx_tools_api_serve.elf serve 18096 >>/tmp/tools_api.log 2>&1" as *u8
339const HC_FIN_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && chmod +x ./nx_fin_serve.elf 2>/dev/null; exec ./nx_fin_serve.elf serve 18097 >>/tmp/fin_serve.log 2>&1" as *u8
342const HC_DIST_CMD: *u8 = "cd /volume1/ai/dist && chmod +x ./nx_dist_serve.elf 2>/dev/null; exec ./nx_dist_serve.elf serve 18120 >>/tmp/dist_serve.log 2>&1" as *u8
346const HC_SEED_CMD: *u8 = "cd /volume1/ai/torrent && chmod +x ./nx_torrent_seed.elf 2>/dev/null; exec ./nx_torrent_seed.elf serve 6881 /volume1/ai/torrent/seed_index.conf >>/tmp/seed.log 2>&1" as *u8
349const HC_SEEDANN_CMD: *u8 = "cd /volume1/ai/torrent && chmod +x ./nx_seed_announce_all.elf 2>/dev/null; exec ./nx_seed_announce_all.elf /volume1/ai/torrent/seed_index.conf >>/tmp/seedann.log 2>&1" as *u8
352const HC_TORSTAT_CMD: *u8 = "cd /volume1/ai/torrent && set -f; chmod +x ./nx_torrent_seedeval.elf 2>/dev/null; : > /tmp/torstat.out; for area in media gallery; do while read b; do echo === $area/$b === >> /tmp/torstat.out; ./nx_torrent_seedeval.elf $area/$b >> /tmp/torstat.out 2>&1; done < $area/torrents.idx 2>/dev/null; done; echo === SEED REGISTRY - what we SHARE back === >> /tmp/torstat.out; cat seed_index.conf >> /tmp/torstat.out 2>/dev/null; echo === seeding $(wc -l < seed_index.conf 2>/dev/null) torrents === >> /tmp/torstat.out" as *u8
356const HC_MP_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && chmod +x ./nx_mp_serve.elf 2>/dev/null; mkdir -p web_assets/_game_build 2>/dev/null; exec ./nx_mp_serve.elf >>/tmp/mp_serve.log 2>&1" as *u8
567const HC_GUARD_INTERVAL_MS: i64 = 300000 // cap_ms: 5 min (K8s CrashLoopBackOff ceiling)
568const HC_GUARD_BURST: i64 = 1000 // base_ms: 1s first backoff step (doubles each repeated crash)
1430const HC_RK_COUNT_PATH: *u8 = "reader_keep.count" as *u8
1854const HC_COPYBUF: i64 = 262144 // chunked-copy buffer for cross-subvolume promote (hc_copy_file)
2132const HC_TC_CC: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nx_cc_sovereign.elf" as *u8
2133const HC_TC_CC_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/runtime/nx_cc_sovereign.elf.new" as *u8
2134const HC_TC_CC_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nx_cc_sovereign.elf.prev" as *u8
2135const HC_TC_CC_BAD: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nx_cc_sovereign.elf.bad" as *u8
2136const HC_TC_ASM: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nxasm_x86_main.elf" as *u8
2137const HC_TC_ASM_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/runtime/nxasm_x86_main.elf.new" as *u8
2138const HC_TC_ASM_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nxasm_x86_main.elf.prev" as *u8
2139const HC_TC_ASM_BAD: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nxasm_x86_main.elf.bad" as *u8
2140const HC_TC_SBR: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nx_sov_build_run.elf" as *u8
2141const HC_TC_SBR_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/runtime/nx_sov_build_run.elf.new" as *u8
2142const HC_TC_SBR_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nx_sov_build_run.elf.prev" as *u8
2143const HC_TC_SBR_BAD: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nx_sov_build_run.elf.bad" as *u8
2930const HC_ROUTERCTL_CMD: *u8 = "cd /volume1/ai/torrent && chmod +x ./nx_router_ctl.elf 2>/dev/null; : > /tmp/routerctl.out; ./nx_router_ctl.elf dash >> /tmp/routerctl.out 2>&1" as *u8
2944const HC_PORTMAP_CMD: *u8 = "cd /volume1/ai/torrent && chmod +x ./nx_natpmp.elf ./nx_upnp_igd.elf 2>/dev/null; : > /tmp/portmap.out; echo === NAT-PMP === >> /tmp/portmap.out; ./nx_natpmp.elf 6881 >> /tmp/portmap.out 2>&1; echo === UPnP-IGD === >> /tmp/portmap.out; ./nx_upnp_igd.elf 6881 >> /tmp/portmap.out 2>&1" as *u8
2967const HC_TRACKERREFRESH_CMD: *u8 = "cd /volume1/ai/torrent && mkdir -p data && chmod +x ./nx_tracker_refresh.elf 2>/dev/null; : > /tmp/trackerrefresh.out; ./nx_tracker_refresh.elf /volume1/ai/torrent/trackers.txt >> /tmp/trackerrefresh.out 2>&1" as *u8
2983const HC_RESEED_CMD: *u8 = "cd /volume1/ai/torrent && chmod +x ./nx_torrent_reseed.elf 2>/dev/null; : > /tmp/reseed.out; ./nx_torrent_reseed.elf /volume1/ai/torrent/media /volume1/ai/torrent/seed_index.conf >> /tmp/reseed.out 2>&1; ./nx_torrent_reseed.elf /volume1/ai/torrent/gallery /volume1/ai/torrent/seed_index.conf >> /tmp/reseed.out 2>&1" as *u8
3202const HC_JOB_AS_CAP: i64 = 17179869184

functions

358func hc_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
359func hc_putn(v: i64) -> i64
365func hc_streq(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 }
368func hc_write_pid(path: *u8, pid: i64) -> i64
378func hc_read_pid(path: *u8) -> i64
392func hc_sup_touch() -> i64 { return hc_write_pid(HC_SUP_LOCK, sys_now_realtime_sec()) }
393func hc_sup_clear() -> i64 { return hc_write_pid(HC_SUP_LOCK, 0) } // mark stale -> the next supervisor claims
394func hc_sup_fresh() -> i64
404func hc_spawn() -> i64
415func hc_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
416func hc_atoi(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8) { let c: u8=s[i]; if c<(48 as u8){return v} if c>(57 as u8){return v} v=v*10+((c-(48 as u8)) as i64); i=i+1 } return v }
417func hc_contains(hay: *u8, hn: i64, needle: *u8, nn: i64) -> i64
427func hc_read_cmdline(path: *u8, buf: *u8, cap: i64) -> i64
439func proc_kill_by_name(needle: *u8, sig: i64) -> i64
486func proc_kill_by_two(n1: *u8, n2: *u8, sig: i64) -> i64
534func proc_alive_by_name(needle: *u8) -> i64
544func hc_spawn_path(pth: *u8) -> i64
572func hc_needs_restart(alive: i64, port: i64) -> i64
581func hc_guard_one(name: *u8, path: *u8, port: i64, ws: *i64, cnt: *i64, pidpath: *u8, write_pid: i64) -> i64
599func hc_spawn_reader() -> i64
613func hc_spawn_galx_serve() -> i64
627func hc_spawn_galx_gw() -> i64
643func hc_spawn_wiki_gw() -> i64
658func hc_spawn_hub_gw() -> i64
674func hc_spawn_gen_orch() -> i64
688func hc_spawn_gen_gw() -> i64
703func hc_spawn_synth() -> i64
718func hc_spawn_devapi() -> i64
733func hc_spawn_torrent() -> i64
748func hc_spawn_torrent_gw() -> i64
769func hc_guard_reader(ws: *i64, cnt: *i64) -> i64
784func hc_guard_galx_serve(ws: *i64, cnt: *i64) -> i64
794func hc_guard_galx_gw(ws: *i64, cnt: *i64) -> i64
807func hc_guard_wiki_gw(ws: *i64, cnt: *i64) -> i64
819func hc_guard_hub_gw(ws: *i64, cnt: *i64) -> i64
830func hc_spawn_relate() -> i64
846func hc_guard_relate(ws: *i64, cnt: *i64) -> i64
857func hc_spawn_cleanserve() -> i64
873func hc_guard_cleanserve(ws: *i64, cnt: *i64) -> i64
884func hc_spawn_mesh_serve() -> i64
900func hc_guard_mesh_serve(ws: *i64, cnt: *i64) -> i64
911func hc_spawn_mesh_gw() -> i64
927func hc_guard_mesh_gw(ws: *i64, cnt: *i64) -> i64
938func hc_spawn_project() -> i64
955func hc_guard_project(ws: *i64, cnt: *i64) -> i64
966func hc_spawn_mgmt() -> i64
982func hc_guard_mgmt(ws: *i64, cnt: *i64) -> i64
993func hc_spawn_admin() -> i64
1009func hc_guard_admin(ws: *i64, cnt: *i64) -> i64
1027func hc_spawn_mailportal() -> i64
1043func hc_guard_mailportal(ws: *i64, cnt: *i64) -> i64
1054func hc_spawn_siteedit() -> i64
1070func hc_guard_siteedit(ws: *i64, cnt: *i64) -> i64
1081func hc_spawn_tapi() -> i64
1097func hc_guard_tapi(ws: *i64, cnt: *i64) -> i64
1108func hc_spawn_fin() -> i64
1124func hc_guard_fin(ws: *i64, cnt: *i64) -> i64
1136func hc_spawn_health() -> i64
1153func hc_guard_health(ws: *i64, cnt: *i64) -> i64
1164func hc_spawn_sig2() -> i64
1180func hc_guard_sig2(ws: *i64, cnt: *i64) -> i64
1191func hc_spawn_dist() -> i64
1207func hc_guard_dist(ws: *i64, cnt: *i64) -> i64
1218func hc_spawn_seed() -> i64
1234func hc_guard_seed(ws: *i64, cnt: *i64) -> i64
1245func hc_spawn_seedann() -> i64
1260func hc_guard_seedann(ws: *i64, cnt: *i64) -> i64
1271func hc_spawn_mp() -> i64
1287func hc_guard_mp(ws: *i64, cnt: *i64) -> i64
1299func hc_guard_gen_orch(ws: *i64, cnt: *i64) -> i64
1309func hc_guard_gen_gw(ws: *i64, cnt: *i64) -> i64
1322func hc_guard_synth(ws: *i64, cnt: *i64) -> i64
1334func hc_guard_devapi(ws: *i64, cnt: *i64) -> i64
1345func cmd_kickdevapi() -> i64
1353func cmd_devapitoolchain() -> i64
1371func hc_guard_torrent(ws: *i64, cnt: *i64) -> i64
1383func hc_guard_torrent_gw(ws: *i64, cnt: *i64) -> i64
1395func hc_guard_login(ws: *i64, cnt: *i64) -> i64
1420func hc_keep_delay(fastfails: i64, shortfails: i64) -> i64
called by 1: cmd_reader_keep
1431func cmd_reader_keep() -> i64
1492func hc_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[off+i]=s[i];i=i+1} return off+i }
1493func hc_catn(dst: *u8, off: i64, v: i64) -> i64
1500func hc_status_row(dst: *u8, off: i64, name: *u8, label: *u8) -> i64
1517func hc_rwin(cnt: *i64, ws: *i64, now: i64) -> i64
called by 1: cmd_supervise
1521func hc_snap_svc(buf: *u8, o: i64, name: *u8, port: i64, rwin: i64) -> i64
1539func hc_emit_snapshot(rw_sites: i64, rw_wiki: i64, rw_ggw: i64, rw_gserve: i64, rw_reader: i64, rw_redirect: i64, rw_tgw: i64, rw_mgmt: i64, rw_adm: i64, rw_vroom: i64, rw_tapi: i64, rw_mail: i64) -> i64
1572func hc_emit_status_html(now: i64) -> i64
1603func hc_assert_overcommit() -> i64
1612func cmd_supervise() -> i64
1726func cmd_deploy() -> i64
1770func cmd_mgmtdeploy() -> i64
1844func cmd_mgmtrollback() -> i64
1859func hc_exists(p: *u8) -> i64 { let fd: i64 = sys_openat_rd(p); if fd < 0 { return 0 } sys_close(fd); return 1 }
1869func hc_put_rc(label: *u8, rc: i64) -> i64
1880func hc_copy_file(src: *u8, dst: *u8) -> i64
1892func hc_file_size(p: *u8) -> i64
1920func hc_promote_to_expect(nhnew: *u8, live: *u8, prev: *u8, expect_size: i64) -> i64
1944func hc_promote_to(nhnew: *u8, live: *u8, prev: *u8) -> i64
1962func hc_pathsuf(dst: *u8, live: *u8, suf: *u8) -> *u8
called by 1: hc_deploy_one calls 1: hc_cat
1973func hc_sovname(dst: *u8, live: *u8) -> *u8
called by 1: hc_deploy_one calls 1: hc_cat
1989func hc_deploy_one(live: *u8, killname: *u8) -> i64
2040func hc_prefix(s: *u8, p: *u8) -> i64
2054func hc_row_field(rowname: *u8, want: i64, out: *u8) -> i64
2110func cmd_gdeploy(live: *u8, killname: *u8) -> i64
2144func cmd_toolchaindeploy() -> i64
2155func cmd_toolchainrollback() -> i64
2166func cmd_torrentdeploy() -> i64
2202func cmd_torrentrollback() -> i64
2218func cmd_relatedeploy() -> i64
2225func cmd_relaterollback() -> i64
2234func cmd_xlatedeploy() -> i64
2241func cmd_xlaterollback() -> i64
2250func cmd_cleanservedeploy() -> i64
2260func cmd_docportaldeploy() -> i64
2267func cmd_docportalrollback() -> i64
2274func cmd_cleanserverollback() -> i64
2283func cmd_rollback() -> i64
2296func cmd_certswap() -> i64
2310func cmd_certrollback() -> i64
2320func hc_spawn_login() -> i64
2336func cmd_logintest() -> i64
2361func cmd_runmtlsproxy() -> i64
2373func cmd_mtlsproxytest() -> i64
2389func cmd_runmirror() -> i64
2400func cmd_mirror() -> i64
2411func cmd_runmirrorpar() -> i64
2421func cmd_mirrorpar() -> i64
2432func cmd_mirrorstop() -> i64
2441func cmd_rundistpub() -> i64
2452func cmd_distpub() -> i64
2462func cmd_rundistserve() -> i64
2472func cmd_rundistprobe() -> i64
2482func cmd_distserve() -> i64
2491func cmd_distprobe() -> i64
2499func cmd_runandelin() -> i64
2509func cmd_runsnir() -> i64
2522func cmd_nftread() -> i64
2533func cmd_nettap(port: *u8) -> i64
2547func cmd_platformtest() -> i64
2564func cmd_logindeploy() -> i64
2577func cmd_loginrollback() -> i64
2592func cmd_hubdeploy() -> i64
2605func cmd_gendeploy() -> i64
2618func cmd_genprobe() -> i64
2643func cmd_takeover() -> i64
2680func cmd_selftest() -> i64
2731func cmd_selfswap() -> i64
2779func cmd_superrollback() -> i64
2796func cmd_supervisetest() -> i64
2812func cmd_spawntest() -> i64
2832func hc_dfork_exec(arg: *u8) -> i64
2850func hc_daemonize_supervise() -> i64 { return hc_dfork_exec(HC_SUPERVISE) }
2854func cmd_sleeper() -> i64
calls 1: sys_sleep_ms
2862func cmd_daemontest() -> i64
2877func cmd_reconcile() -> i64
2897func cmd_kickreader() -> i64
2910func cmd_kicktorrent() -> i64
2921func cmd_kickseed() -> i64
2931func cmd_routerctl() -> i64
2945func cmd_portmap() -> i64
2968func cmd_trackerrefresh() -> i64
2984func cmd_reseed() -> i64
3001func cmd_kickworkers() -> i64
3009func cmd_torstat() -> i64
3023func cmd_kickseedann() -> i64
3034func cmd_kicktorrentgw() -> i64
3048func cmd_killdurindex() -> i64
3059func hc_spawn_durindex_job() -> i64
3086func hc_spawn_pipeline_job() -> i64
3112func hc_spawn_idxbackfill_job() -> i64
3140func cmd_galxidxkick() -> i64
3160func cmd_galxpipelinekick() -> i64
3177func cmd_galxidxrun() -> i64
3184func cmd_galxpipeline() -> i64
3203func hc_spawn_searchpipe_job(organ: *u8, a1: *u8, a2: *u8) -> i64
3241func cmd_searchpagerank() -> i64
3249func cmd_searchcompact() -> i64
3269func hc_file_age_s(path: *u8) -> i64
3278func cmd_searchcrawl() -> i64
3308func cmd_durindexrun() -> i64
3315func hc_count_lines(path: *u8) -> i64
3324func hc_tail(path: *u8, nb: i64) -> i64
3334func cmd_durindexstat() -> i64
3345func hc_nth_line(buf: *u8, sz: i64, n: i64, out: *u8) -> i64
called by 1: cmd_tsdurtest
3359func cmd_tsdurtest() -> i64
3384func cmd_durbinbuild() -> i64
3409func hc_copyfile(src: *u8, dst: *u8) -> i64
3424func cmd_buildrun(name: *u8) -> i64
3504func cmd_buildsetup() -> i64
3517func cmd_galxdurprobe() -> i64
3547func hc_loopback_req(req: *u8, buf: *u8, cap: i64, totp: *i64) -> i64
3563func hc_body_eq(buf: *u8, bs: i64, tot: i64, exp: *u8) -> i64
called by 1: cmd_galxtagprobe
3573func cmd_galxtagprobe() -> i64
3593func hc_body_has(buf: *u8, bs: i64, tot: i64, needle: *u8) -> i64
called by 1: cmd_galxstreamprobe
3609func cmd_galxstreamprobe() -> i64
3652func cmd_galxgwprobe() -> i64
3677func cmd_galxauthprobe() -> i64
3705func cmd_galxregprobe() -> i64
3730func cmd_kicksites() -> i64
3738func cmd_kicksynth() -> i64
3747func cmd_kickdocportal() -> i64
3758func hc_cmdl_has(buf: *u8, n: i64, name: *u8) -> i64
3775func hc_kill_by_cmdline(name: *u8) -> i64