code wiki / _hdl_build / nx_hostctl.nx

nx_hostctl.nx

buildroot/runtime/_hdl_build/nx_hostctl.nx

262144 B3750 linesdepth 7pulls 15 transitivereach 4 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 9 imports · 4 importers

nx_syscalls.nx nx_file_install.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_buildrun_verdict_lib.nx nx_hostctl.nx nx_deploy_capture_selection_gate.n nx_fio_region_gate.nx nx_hostctl_supervise_gate.nx nx_rollback_executor_t185.nx

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

imported by: nx_deploy_capture_selection_gate.nxnx_fio_region_gate.nxnx_hostctl_supervise_gate.nxnx_rollback_executor_t185.nx

structs

none

consts

31const HC_CRAWL_STALE_S: i64 = 600
32const HC_MAGIC_65536: i64 = 65536
33const HC_MAGIC_8192: i64 = 8192
34const HC_MAGIC_60000: i64 = 60000
35const HC_MAGIC_300000: i64 = 300000
36const HC_MAGIC_8791: i64 = 8791
37const HC_MAGIC_5000: i64 = 5000
38const HC_MAGIC_5000000: i64 = 5000000
39const HC_MAGIC_300000000: i64 = 300000000
40const HC_MAGIC_4096: i64 = 4096
41const HC_MAGIC_8443: i64 = 8443
42const HC_MAGIC_18791: i64 = 18791
43const HC_MAGIC_18190: i64 = 18190
44const HC_MAGIC_18090: i64 = 18090
45const HC_MAGIC_18095: i64 = 18095 // nx_daemon_supervisor /status (the fleet supervisor's liveness surface)
46const HC_MAGIC_8080: i64 = 8080
47const HC_MAGIC_18793: i64 = 18793
48const HC_MAGIC_18098: i64 = 18098
49const HC_MAGIC_18456: i64 = 18456
50const HC_MAGIC_8456: i64 = 8456
51const HC_MAGIC_15274: i64 = 15274
52const HC_MAGIC_18465: i64 = 18465
53const HC_MAGIC_18466: i64 = 18466
54const HC_MAGIC_8446: i64 = 8446
55const HC_MAGIC_18096: i64 = 18096
56const HC_MAGIC_16384: i64 = 16384
57const HC_MAGIC_7443: i64 = 7443
58const HC_MAGIC_18792: i64 = 18792
59const HC_MAGIC_9091: i64 = 9091
60const HC_MAGIC_8097: i64 = 8097
61const HC_MAGIC_18795: i64 = 18795
62const HC_MAGIC_18794: i64 = 18794
63const HC_MAGIC_18796: i64 = 18796
64const HC_MAGIC_18797: i64 = 18797
65const HC_MAGIC_18099: i64 = 18099
66const HC_MAGIC_18097: i64 = 18097
67const HC_MAGIC_18120: i64 = 18120
68const HC_MAGIC_7702: i64 = 7702
69const HC_MAGIC_6881: i64 = 6881
70const HC_MAGIC_8445: i64 = 8445
71const HC_MAGIC_8027: i64 = 8027
72const HC_MAGIC_8028: i64 = 8028
73const HC_MAGIC_8102: i64 = 8102
74const HC_MAGIC_8029: i64 = 8029
75const HC_MAGIC_8055: i64 = 8055
76const HC_MAGIC_8447: i64 = 8447
77const HC_MAGIC_1195: i64 = 1195
78const HC_MAGIC_5080: i64 = 5080
79const HC_MAGIC_15000: i64 = 15000
80const HC_MAGIC_1500: i64 = 1500
81const HC_MAGIC_2500: i64 = 2500
82const HC_MAGIC_4000: i64 = 4000
83const HC_MAGIC_1200: i64 = 1200
84const HC_MAGIC_2000: i64 = 2000
85const HC_MAGIC_131072: i64 = 131072
86const HC_MAGIC_3600000: i64 = 3600000
87const HC_MAGIC_262144: i64 = 262144
88const HC_MAGIC_2048: i64 = 2048
89const HC_MAGIC_40302: i64 = 40302
90const HC_MAGIC_1048576: i64 = 1048576
91const HC_MAGIC_16000: i64 = 16000
92const HC_MAGIC_16777232: i64 = 16777232
93const HC_MAGIC_16777216: i64 = 16777216
94const HC_MAGIC_90000: i64 = 90000
95const HC_MAGIC_1024: i64 = 1024
96const HC_MAGIC_65535: i64 = 65535
97const HC_MAGIC_8191: i64 = 8191
98const HC_MAGIC_2026: i64 = 2026
99const HC_MAGIC_25000: i64 = 25000
100const HC_MAGIC_86400000: i64 = 86400000
101const HC_MAGIC_3000: i64 = 3000
102const HC_MAGIC_6000: i64 = 6000
104const HC_ELF: *u8 = "/volume1/homes/elderwesto/nishihost/sites.elf" as *u8
105const HC_ELF_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/sites.elf.new" as *u8
106const HC_ELF_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/sites.elf.prev" as *u8 // rollback copy (never-brick)
107const HC_REDIRECT: *u8 = "/volume1/homes/elderwesto/nishihost/redirect.elf" as *u8
114const HC_ARCSRV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_archive_server.elf" as *u8
115const HC_VROOM: *u8 = "/volume1/homes/elderwesto/nishihost/nx_vroom_daemon.elf" as *u8
116const HC_SNIROUTER:*u8 = "/volume1/homes/elderwesto/nishihost/sni_router.elf" as *u8 // sovereign public-edge SNI router (:7443, TLS passthrough)
117const HC_XLATE: *u8 = "/volume1/homes/elderwesto/nishihost/nx_translate_daemon.elf" as *u8
118const HC_XLATE_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_translate_daemon.sov.elf.new" as *u8
119const HC_XLATE_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_translate_daemon.elf.prev" as *u8
120const HC_SIGKILL: i64 = 9
121const 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)
122const HC_CONF: *u8 = "/volume1/homes/elderwesto/nishihost/sites.conf" as *u8
123const HC_CONF_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/sites.conf.new" as *u8
124const HC_DOCROOT: *u8 = "/volume1/homes/elderwesto/nishihost/sites/andelinwest" as *u8
125const HC_INDEX: *u8 = "/volume1/homes/elderwesto/nishihost/sites/andelinwest/index.html" as *u8
126const HC_INDEX_NEW:*u8 = "/volume1/homes/elderwesto/nishihost/andelinwest_index.html.new" as *u8
127const HC_PID: *u8 = "/volume1/homes/elderwesto/nishihost/sites.pid" as *u8
129const HC_CERT_LIVE: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_fullchain.der" as *u8
130const HC_CERT_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_fullchain.der.new" as *u8
131const HC_CERT_BAK: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_fullchain.der.bak" as *u8
132const HC_KEY_LIVE: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_ecdsa_key.bin" as *u8
133const HC_KEY_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_ecdsa_key.bin.new" as *u8
134const HC_KEY_BAK: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_ecdsa_key.bin.bak" as *u8
136const HC_READER: *u8 = "/volume1/homes/elderwesto/nishi-reader/nx_media_server_auth.elf" as *u8
137const HC_READER_DIR: *u8 = "/volume1/homes/elderwesto/nishi-reader" as *u8
138const HC_READER_KEYS: *u8 = "/volume1/homes/elderwesto/nishihost/auth/keys" as *u8
139const HC_READER_STORE:*u8 = "/volume1/homes/elderwesto/nishihost/auth/store" as *u8
142const HC_SELF: *u8 = "/volume1/homes/elderwesto/nishihost/nx_hostctl" as *u8
143const HC_SELF_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_hostctl.new" as *u8
147const HC_SELF_NEW_SOV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_hostctl.sov.elf.new" as *u8
148const 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)
149const HC_BUILD_DEBUG_FLAG: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/build_debug.flag" as *u8 // 1 = every buildrun passes --debug (2026-09-02): DWARF .debug_line appended past the image so a crash address resolves on the deployed binary; any other content or an absent file = no flag
150const 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)
154const HC_REALM: *u8 = "Nishi Wiki" as *u8
155const HC_PORT: *u8 = "8791" as *u8
156const HC_SUPERVISE: *u8 = "supervise" as *u8 // selfswap's re-exec argv[1] -- same const-not-inline-literal rule
157const HC_RUNSITE: *u8 = "runsite" as *u8 // startsite's hc_dfork_exec arg -> cmd_runsite execs sites.elf (sovereign, no sh -c)
162const HC_SLEEPER: *u8 = "sleeper" as *u8 // daemontest payload: a sovereign sleep loop (no OS /bin/sleep)
166const HC_RUNMIRROR: *u8 = "runmirror" as *u8
167const HC_MIRROR_BIN: *u8 = "/volume1/ai/apertus/nx_apertus_mirror_nas.elf" as *u8
170const HC_RUNMIRRORPAR: *u8 = "runmirrorpar" as *u8
171const HC_MIRRORPAR_BIN: *u8 = "/volume1/ai/apertus/nx_par_pull_nas.elf" as *u8
173const HC_DISTPUB_BIN: *u8 = "/volume1/ai/dist/nx_dist_publish_run.elf" as *u8
174const HC_RUNDISTPUB: *u8 = "rundistpub" as *u8
177const HC_DISTSERVE_BIN: *u8 = "/volume1/ai/dist/nx_dist_serve.elf" as *u8
178const HC_RUNDISTSERVE: *u8 = "rundistserve" as *u8
179const HC_RUNDISTPROBE: *u8 = "rundistprobe" as *u8
180const HC_A_SERVE: *u8 = "serve" as *u8
181const HC_A_PROBE: *u8 = "probe" as *u8
182const HC_A_PORT: *u8 = "18120" as *u8
183const HC_DIST_PROBE_PATH: *u8 = "/dist/509b6d9d22987cf7b1067a7cc6b74b88cf0c8c2739748fe5e85a4da0f69ebf1a/model.safetensors.index.json" as *u8
191const HC_SH: *u8 = "/bin/sh" as *u8
192const HC_DASHC: *u8 = "-c" as *u8
193const 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
198const HC_GALX_GW: *u8 = "/volume1/ai/galx/nx_gallery_gateway.elf" as *u8
199const HC_GALX_GW_NEW: *u8 = "/volume1/ai/galx/nx_gallery_gateway.elf.new" as *u8
202const HC_GALX_GW_PREV: *u8 = "/volume1/ai/galx/nx_gallery_gateway.elf.prev" as *u8
203const HC_GALX_GW_SOVNEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_gallery_gateway.sov.elf.new" as *u8
204const HC_GALX_SERVE: *u8 = "/volume1/ai/galx/nx_gallery_serve.elf" as *u8
205const HC_GALX_SERVE_NEW: *u8 = "/volume1/ai/galx/nx_gallery_serve.elf.new" as *u8
206const HC_GALX_SERVE_CMD: *u8 = "cd /volume1/ai/galx && exec ./nx_gallery_serve.elf 18090 >>/tmp/galx_serve.log 2>&1" as *u8
214const HC_ARCSRV_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && exec ./nx_archive_server.elf >>/tmp/arcsrv.log 2>&1" as *u8
220const 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
223const HC_WIKI_GW: *u8 = "/volume1/ai/wiki/nx_wiki_gw.elf" as *u8
224const HC_WIKI_GW_NEW: *u8 = "/volume1/ai/wiki/nx_wiki_gw.elf.new" as *u8
225const 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
228const HC_HUB_GW: *u8 = "/volume1/ai/hub/nx_hub_gw.elf" as *u8
229const HC_HUB_GW_NEW: *u8 = "/volume1/ai/hub/nx_hub_gw.elf.new" as *u8
231const HC_RELATE: *u8 = "/volume1/homes/elderwesto/nishihost/nx_relate_daemon.elf" as *u8
232const HC_RELATE_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_relate_daemon.elf.new" as *u8
233const HC_RELATE_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_relate_daemon.elf.prev" as *u8
234const HC_RELATE_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && exec ./nx_relate_daemon.elf >>/tmp/relate_daemon.log 2>&1" as *u8
236const HC_CLEANSERVE: *u8 = "/volume1/homes/elderwesto/nishihost/nx_clean_serve_daemon.elf" as *u8
237const HC_CLEANSERVE_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_clean_serve_daemon.elf.new" as *u8
238const HC_DOCPORTAL: *u8 = "/volume1/homes/elderwesto/nishihost/nx_docportal_admin_daemon.elf" as *u8
239const HC_DOCPORTAL_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_docportal_admin_daemon.sov.elf.new" as *u8
240const HC_DOCPORTAL_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_docportal_admin_daemon.elf.prev" as *u8
241const HC_CLEANSERVE_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_clean_serve_daemon.elf.prev" as *u8
242const HC_CLEANSERVE_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && exec ./nx_clean_serve_daemon.elf 8102 >>/tmp/cleanserve.log 2>&1" as *u8
246const HC_MESH_SERVE_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && exec ./nx_mesh_serve.elf 8029 >>/tmp/mesh_serve.log 2>&1" as *u8
247const 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
248const 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
249const 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
256const 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
265const 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
266const 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
267const HC_MAGIC_18122: i64 = 18122
271const HC_INVENTORY_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && chmod +x ./nx_inventory_serve.elf 2>/dev/null; exec ./nx_inventory_serve.elf 18122 opaque_keys.bin opaque_store.log nishi_site_admin 1000000 >>/tmp/inventory.log 2>&1" as *u8
272const 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
277const 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
281const 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
286const HC_TORRENT_CMD: *u8 = "cd /volume1/ai/torrent && exec ./nx_media_env.sov.elf hub >>/tmp/torrentd.log 2>&1" as *u8
289const 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
297const 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
298const 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
301const HC_SYNTH_CMD: *u8 = "cd /volume1/ai/synth && exec ./nx_synth_serve_daemon.elf 18796 >>/tmp/synth.log 2>&1" as *u8
304const 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
307const HC_LOGIN: *u8 = "/volume1/homes/elderwesto/nishihost/nx_opaque_login.elf" as *u8
308const HC_LOGIN_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/nx_opaque_login.elf.new" as *u8
309const HC_LOGIN_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/nx_opaque_login.elf.prev" as *u8
322const 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
323const 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
327const HC_RUNMTLSPROXY: *u8 = "runmtlsproxy" as *u8
328const HC_MTLS_PROXY_BIN: *u8 = "/volume1/homes/elderwesto/nishihost/nx_aw_mtls_proxy.elf" as *u8
329const HC_MP_PORT: *u8 = "9444" as *u8
330const HC_MP_BACKEND: *u8 = "18791" as *u8
333const HC_RUNANDELIN: *u8 = "runandelin" as *u8
334const HC_ANDELIN_BIN: *u8 = "/volume1/homes/elderwesto/nishihost/nx_andelinwest_daemon.elf" as *u8
335const HC_RUNSNIR: *u8 = "runsnir" as *u8
336const HC_SNIR_BIN: *u8 = "/volume1/homes/elderwesto/nishihost/nx_sni_router.elf" as *u8
337const HC_SNIR_PORT: *u8 = "8444" as *u8
338const HC_SNIR_BACKEND: *u8 = "8443" as *u8
339const 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)
340const 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)
345const HC_SITES_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost && exec ./sites.elf >>/tmp/sites_run.log 2>&1" as *u8
351const HC_LIB_ELF: *u8 = "/volume1/homes/elderwesto/nishihost/lib/nx_lib_httpd.elf" as *u8
352const HC_LIB_ELF_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/lib/nx_lib_httpd.elf.new" as *u8
353const HC_LIB_CMD: *u8 = "cd /volume1/homes/elderwesto/nishihost/lib && exec ./nx_lib_httpd.elf >>/tmp/lib_run.log 2>&1" as *u8
356const HC_GENPROBE_CMD: *u8 = "exec /volume1/ai/gen/nx_gen_live_probe.elf >/volume1/ai/gen/genprobe.out 2>&1" as *u8
360const 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
363const 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
366const 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
370const 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
373const 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
376const 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
380const 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
591const HC_GUARD_INTERVAL_MS: i64 = 300000 // cap_ms: 5 min (K8s CrashLoopBackOff ceiling)
592const HC_GUARD_BURST: i64 = 1000 // base_ms: 1s first backoff step (doubles each repeated crash)
1074const HC_ADMIN_BIND_GRACE_POLLS: i64 = 40
1316const HC_DSUP_ELF: *u8 = "/volume1/homes/elderwesto/nishihost/nx_daemon_supervisor.elf" as *u8
1317const HC_DSUP_ARGV0: *u8 = "./nx_daemon_supervisor.elf" as *u8
1318const HC_DSUP_STDOUT: *u8 = "/tmp/daemon_supervisor_stdout.log" as *u8
1351const HC_DSUP_STALE_POLLS: i64 = 20 // 20 polls x 15 s = 300 s with no advance
1355const HC_DSUP_SILENT_POLLS: i64 = 40
1356const HC_DSUP_READ_TMO_MS: i64 = 3000
1357const HC_DSUP_STATUS_REQ: *u8 = "GET /status HTTP/1.1\r\nHost: 127.0.0.1:18095\r\nConnection: close\r\n\r\n"
1358const HC_DSUP_CYCLE_KEY: *u8 = "cycle="
1364const HC_DSUP_TICK_KEY: *u8 = "tick="
1661const HC_RK_COUNT_PATH: *u8 = "reader_keep.count" as *u8
2106const HC_COPYBUF: i64 = 262144 // chunked-copy buffer for cross-subvolume promote (hc_copy_file)
2450const HC_TC_CC: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nx_cc_sovereign.elf" as *u8
2451const HC_TC_CC_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/runtime/nx_cc_sovereign.elf.new" as *u8
2452const HC_TC_CC_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nx_cc_sovereign.elf.prev" as *u8
2453const HC_TC_CC_BAD: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nx_cc_sovereign.elf.bad" as *u8
2454const HC_TC_ASM: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nxasm_x86_main.elf" as *u8
2455const HC_TC_ASM_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/runtime/nxasm_x86_main.elf.new" as *u8
2456const HC_TC_ASM_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nxasm_x86_main.elf.prev" as *u8
2457const HC_TC_ASM_BAD: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nxasm_x86_main.elf.bad" as *u8
2458const HC_TC_SBR: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nx_sov_build_run.elf" as *u8
2459const HC_TC_SBR_NEW: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/runtime/nx_sov_build_run.elf.new" as *u8
2460const HC_TC_SBR_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nx_sov_build_run.elf.prev" as *u8
2461const HC_TC_SBR_BAD: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_offc/nx_sov_build_run.elf.bad" as *u8
3243const 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
3257const 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
3280const 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
3296const 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
3526const HC_JOB_AS_CAP: i64 = 17179869184

functions

382func 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 }
383func hc_putn(v: i64) -> i64
389func 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 }
392func hc_write_pid(path: *u8, pid: i64) -> i64
402func hc_read_pid(path: *u8) -> i64
416func hc_sup_touch() -> i64 { return hc_write_pid(HC_SUP_LOCK, sys_now_realtime_sec()) }
417func hc_sup_clear() -> i64 { return hc_write_pid(HC_SUP_LOCK, 0) } // mark stale -> the next supervisor claims
418func hc_sup_fresh() -> i64
428func hc_spawn() -> i64
439func hc_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
440func 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 }
441func hc_contains(hay: *u8, hn: i64, needle: *u8, nn: i64) -> i64
451func hc_read_cmdline(path: *u8, buf: *u8, cap: i64) -> i64
463func proc_kill_by_name(needle: *u8, sig: i64) -> i64
510func proc_kill_by_two(n1: *u8, n2: *u8, sig: i64) -> i64
558func proc_alive_by_name(needle: *u8) -> i64
568func hc_spawn_path(pth: *u8) -> i64
596func hc_needs_restart(alive: i64, port: i64) -> i64
605func hc_guard_one(name: *u8, path: *u8, port: i64, ws: *i64, cnt: *i64, pidpath: *u8, write_pid: i64) -> i64
623func hc_spawn_reader() -> i64
637func hc_spawn_galx_serve() -> i64
653func hc_spawn_arcsrv() -> i64
667func hc_spawn_galx_gw() -> i64
683func hc_spawn_wiki_gw() -> i64
698func hc_spawn_hub_gw() -> i64
714func hc_spawn_gen_orch() -> i64
728func hc_spawn_gen_gw() -> i64
743func hc_spawn_synth() -> i64
758func hc_spawn_devapi() -> i64
773func hc_spawn_torrent() -> i64
788func hc_spawn_torrent_gw() -> i64
809func hc_guard_reader(ws: *i64, cnt: *i64) -> i64
824func hc_guard_galx_serve(ws: *i64, cnt: *i64) -> i64
837func hc_guard_arcsrv(ws: *i64, cnt: *i64) -> i64
847func hc_guard_galx_gw(ws: *i64, cnt: *i64) -> i64
860func hc_guard_wiki_gw(ws: *i64, cnt: *i64) -> i64
872func hc_guard_hub_gw(ws: *i64, cnt: *i64) -> i64
883func hc_spawn_relate() -> i64
899func hc_guard_relate(ws: *i64, cnt: *i64) -> i64
910func hc_spawn_cleanserve() -> i64
926func hc_guard_cleanserve(ws: *i64, cnt: *i64) -> i64
937func hc_spawn_mesh_serve() -> i64
953func hc_guard_mesh_serve(ws: *i64, cnt: *i64) -> i64
964func hc_spawn_mesh_gw() -> i64
980func hc_guard_mesh_gw(ws: *i64, cnt: *i64) -> i64
991func hc_spawn_project() -> i64
1008func hc_guard_project(ws: *i64, cnt: *i64) -> i64
1019func hc_spawn_mgmt() -> i64
1035func hc_guard_mgmt(ws: *i64, cnt: *i64) -> i64
1046func hc_spawn_admin() -> i64
1076func hc_guard_admin(ws: *i64, cnt: *i64) -> i64
1110func hc_spawn_mailportal() -> i64
1126func hc_guard_mailportal(ws: *i64, cnt: *i64) -> i64
1137func hc_spawn_siteedit() -> i64
1153func hc_guard_siteedit(ws: *i64, cnt: *i64) -> i64
1163func hc_spawn_inventory() -> i64
1181func hc_guard_inventory(ws: *i64, cnt: *i64) -> i64
1192func hc_spawn_tapi() -> i64
1208func hc_guard_tapi(ws: *i64, cnt: *i64) -> i64
1219func hc_spawn_fin() -> i64
1235func hc_guard_fin(ws: *i64, cnt: *i64) -> i64
1247func hc_spawn_health() -> i64
1264func hc_guard_health(ws: *i64, cnt: *i64) -> i64
1275func hc_spawn_sig2() -> i64
1291func hc_guard_sig2(ws: *i64, cnt: *i64) -> i64
1319func hc_spawn_dsup() -> i64
1366func hc_dsup_scan(buf: *u8, bs: i64, n: i64, key: *u8) -> i64
called by 1: hc_dsup_cycle calls 1: hc_slen
1385func hc_dsup_cycle() -> i64
1396func hc_guard_dsup(ws: *i64, cnt: *i64, st: *i64) -> i64
1422func hc_spawn_dist() -> i64
1438func hc_guard_dist(ws: *i64, cnt: *i64) -> i64
1449func hc_spawn_seed() -> i64
1465func hc_guard_seed(ws: *i64, cnt: *i64) -> i64
1476func hc_spawn_seedann() -> i64
1491func hc_guard_seedann(ws: *i64, cnt: *i64) -> i64
1502func hc_spawn_mp() -> i64
1518func hc_guard_mp(ws: *i64, cnt: *i64) -> i64
1530func hc_guard_gen_orch(ws: *i64, cnt: *i64) -> i64
1540func hc_guard_gen_gw(ws: *i64, cnt: *i64) -> i64
1553func hc_guard_synth(ws: *i64, cnt: *i64) -> i64
1565func hc_guard_devapi(ws: *i64, cnt: *i64) -> i64
1576func cmd_kickdevapi() -> i64
1584func cmd_devapitoolchain() -> i64
1602func hc_guard_torrent(ws: *i64, cnt: *i64) -> i64
1614func hc_guard_torrent_gw(ws: *i64, cnt: *i64) -> i64
1626func hc_guard_login(ws: *i64, cnt: *i64) -> i64
1651func hc_keep_delay(fastfails: i64, shortfails: i64) -> i64
called by 1: cmd_reader_keep
1662func cmd_reader_keep() -> i64
1730func 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 }
1731func hc_catn(dst: *u8, off: i64, v: i64) -> i64
1738func hc_status_row(dst: *u8, off: i64, name: *u8, label: *u8) -> i64
1755func hc_rwin(cnt: *i64, ws: *i64, now: i64) -> i64
called by 1: cmd_supervise
1759func hc_snap_svc(buf: *u8, o: i64, name: *u8, port: i64, rwin: i64) -> i64
1777func 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
1811func hc_emit_status_html(now: i64) -> i64
1842func hc_assert_overcommit() -> i64
1851func cmd_supervise() -> i64
1978func cmd_deploy() -> i64
2022func cmd_mgmtdeploy() -> i64
2096func cmd_mgmtrollback() -> i64
2111func hc_exists(p: *u8) -> i64 { let fd: i64 = sys_openat_rd(p); if fd < 0 { return 0 } sys_close(fd); return 1 }
2121func hc_put_rc(label: *u8, rc: i64) -> i64
2132func hc_copy_file(src: *u8, dst: *u8) -> i64
2144func hc_file_size(p: *u8) -> i64
2172func hc_promote_to_expect(nhnew: *u8, live: *u8, prev: *u8, expect_size: i64) -> i64
2217func hc_promote_to(nhnew: *u8, live: *u8, prev: *u8) -> i64
2235func hc_pathsuf(dst: *u8, live: *u8, suf: *u8) -> *u8
2246func hc_sovname(dst: *u8, live: *u8) -> *u8
called by 1: hc_deploy_one calls 1: hc_cat
2262func hc_deploy_one(live: *u8, killname: *u8) -> i64
2313func hc_prefix(s: *u8, p: *u8) -> i64
2327func hc_row_field(rowname: *u8, want: i64, out: *u8) -> i64
2383func cmd_gdeploy(live: *u8, killname: *u8) -> i64
2410func cmd_gdeploy_rollback(live: *u8, killname: *u8) -> i64
2462func cmd_toolchaindeploy() -> i64
2473func cmd_toolchainrollback() -> i64
2484func cmd_torrentdeploy() -> i64
2520func cmd_torrentrollback() -> i64
2536func cmd_relatedeploy() -> i64
2543func cmd_relaterollback() -> i64
2552func cmd_xlatedeploy() -> i64
2559func cmd_xlaterollback() -> i64
2568func cmd_cleanservedeploy() -> i64
2578func cmd_docportaldeploy() -> i64
2585func cmd_docportalrollback() -> i64
2592func cmd_cleanserverollback() -> i64
2601func cmd_rollback() -> i64
2614func cmd_certswap() -> i64
2628func cmd_certrollback() -> i64
2638func hc_spawn_login() -> i64
2654func cmd_logintest() -> i64
2679func cmd_runmtlsproxy() -> i64
2691func cmd_mtlsproxytest() -> i64
2707func cmd_runmirror() -> i64
2718func cmd_mirror() -> i64
2729func cmd_runmirrorpar() -> i64
2739func cmd_mirrorpar() -> i64
2750func cmd_mirrorstop() -> i64
calls 2: hc_putshc_putn
2759func cmd_rundistpub() -> i64
2770func cmd_distpub() -> i64
2780func cmd_rundistserve() -> i64
2790func cmd_rundistprobe() -> i64
2800func cmd_distserve() -> i64
2809func cmd_distprobe() -> i64
2817func cmd_runandelin() -> i64
2827func cmd_runsnir() -> i64
2840func cmd_nftread() -> i64
2851func cmd_nettap(port: *u8) -> i64
2865func cmd_platformtest() -> i64
2882func cmd_logindeploy() -> i64
2895func cmd_loginrollback() -> i64
2910func cmd_hubdeploy() -> i64
2923func cmd_gendeploy() -> i64
2936func cmd_genprobe() -> i64
2961func cmd_takeover() -> i64
2998func cmd_selftest() -> i64
3049func cmd_selfswap() -> i64
3092func cmd_superrollback() -> i64
3109func cmd_supervisetest() -> i64
3125func cmd_spawntest() -> i64
3145func hc_dfork_exec(arg: *u8) -> i64
3163func hc_daemonize_supervise() -> i64 { return hc_dfork_exec(HC_SUPERVISE) }
3167func cmd_sleeper() -> i64
calls 1: sys_sleep_ms
3175func cmd_daemontest() -> i64
3190func cmd_reconcile() -> i64
3210func cmd_kickreader() -> i64
3223func cmd_kicktorrent() -> i64
3234func cmd_kickseed() -> i64
3244func cmd_routerctl() -> i64
3258func cmd_portmap() -> i64
3281func cmd_trackerrefresh() -> i64
3297func cmd_reseed() -> i64
3314func cmd_kickworkers() -> i64
3322func cmd_torstat() -> i64
3336func cmd_kickseedann() -> i64
3347func cmd_kicktorrentgw() -> i64
3361func cmd_killdurindex() -> i64
3372func hc_spawn_durindex_job() -> i64
3399func hc_spawn_pipeline_job() -> i64
3425func hc_spawn_idxbackfill_job() -> i64
3453func cmd_galxidxkick() -> i64
3473func cmd_galxpipelinekick() -> i64
3490func cmd_galxidxrun() -> i64
3497func cmd_galxpipeline() -> i64
3527func hc_spawn_searchpipe_job(organ: *u8, a1: *u8, a2: *u8) -> i64
3574func cmd_searchpagerank() -> i64
3582func cmd_searchcompact() -> i64
3602func hc_file_age_s(path: *u8) -> i64
3611func cmd_searchcrawl() -> i64
3641func cmd_durindexrun() -> i64
3648func hc_count_lines(path: *u8) -> i64
3657func hc_tail(path: *u8, nb: i64) -> i64
3667func cmd_durindexstat() -> i64
3678func hc_nth_line(buf: *u8, sz: i64, n: i64, out: *u8) -> i64
called by 1: cmd_tsdurtest
3692func cmd_tsdurtest() -> i64
3717func cmd_durbinbuild() -> i64
3742func hc_copyfile(src: *u8, dst: *u8) -> i64