code wiki / _hdl_build / nx_pub_recover_exec.nx

nx_pub_recover_exec.nx

buildroot/runtime/_hdl_build/nx_pub_recover_exec.nx

4091 B75 linesdepth 4pulls 6 transitivereach 5 importersview sourcekind tooltopic pub
docsdependenciesstructsconstsfunctions

about

nx_pub_recover_exec.nx -- THE PUBLISHER'S RECOVERY EXECUTOR (the action rung after nx_pub_recover's decision). Consumes PENDING recovery requests from the queue, KILLS the wedged daemon by name (proc_kill_by_name -> the existing nx_hostctl keeper respawns a FRESH one = the wedge clears), flips the queue line PENDING->DONE (atomic rewrite under fl_acquire), and appends a recovery LEDGER record. The Publisher owns the recovery ACTION; hosting's supervisor owns the respawn (its existing job) -> clean separation, no second supervisor, no touching nx_hostctl. SIGTERM (15) = graceful; never-brick #26 (kill+supervised-respawn is reversible, no destructive write). Runs on the host where the daemons live (NAS); the gate proves it on a real mock. pe_exec(queuepath, ledgerpath) -> number of recoveries executed license_tier: ORIGINAL

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_proc_ctl.nx nx_pub_recover.nx nx_pub_recover_exec.nx nx_pub_recover_exec_gate.nx nx_pub_recover_pulse.nx

imports: nx_syscalls.nxnx_proc_ctl.nxnx_pub_recover.nx

imported by: nx_pub_recover_exec_gate.nxnx_pub_recover_pulse.nx

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

main pe_uw sys_write pe_exec fl_acquire fl_try fl_mkdir sys_mmap fl_path sys_openat_wr sys_flock sys_close fl_nap sys_mmap ↻ sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ↻ fl_release sys_flock ↻ sys_close ↻ pr_field proc_kill_by_name pc_slen sys_openat_rd ↻ sys_mmap ↻ sys_getdents64 dirent_reclen dirent_name pc_read_cmdline sys_openat_rd ↻ sys_read ↻ sys_close ↻ pc_contains nx_kill pc_atoi sys_close ↻

structs

none

consts

14const PE_MAGIC_100000: i64 = 100000
15const PE_MAGIC_4096: i64 = 4096
17const PE_QUEUE: *u8 = "knowledge/publish/recovery_queue.tsv"
18const PE_LEDGER: *u8 = "knowledge/publish/recovery_ledger.tsv"
19const PE_LOCK: *u8 = "publish_recover"
20const PE_SIGTERM: i64 = 15

functions

22func pe_exec(queuepath: *u8, ledgerpath: *u8) -> i64
69func pe_uw(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
70func main(argc: i64, argv: *i64) -> i64