code wiki / (root) / nx_state_spool.nx

nx_state_spool.nx

buildroot/runtime/nx_state_spool.nx

2575 B62 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind tooltopic state
docsdependenciesstructsconstsfunctions

about

nx_state_spool.nx -- CLI of the store-and-forward state spool (CR-R1a; NAS=hub, laptop=worker: sync to the NAS whenever reachable, go local when it isn't, drain on reconnect). usage: nx_state_spool spool <spoolfile> <line> append one state line locally (flock'd) nx_state_spool drain <spoolfile> <transport_elf> deliver each line via transport (argv[1]= line, exit 0=delivered); failures KEPT lock = <spoolfile>.lock, tmp = <spoolfile>.tmp (atomic rewrite). Exit 0 on success (kept>0 is NOT an error -- offline is a normal state); 2 = usage; 3 = spool/lock failure. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_state_spool_core.nx nx_state_spool.nx

imports: nx_syscalls.nxnx_state_spool_core.nx

imported by: nobody (leaf or entry point)

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

main sp_puts sys_write sys_mmap ccz_cat_str sp_streq ssp_spool ssp_lock sys_openat_wr sys_flock sys_close sys_openat_append ssp_unlock sys_flock ↻ sys_close ↻ ccz_slen sys_write ↻ sys_close ↻ ssp_drain ssp_lock ↻ sys_mmap ↻ ccz_read sys_openat_rd sys_read sys_close ↻ ssp_unlock ↻ ssp_run_transport sys_fork sys_mmap ↻ sys_execve sys_exit sys_wait4 wait_exit_code sys_openat_wr ↻ sys_write ↻ sys_fsync sys_close ↻ sys_renameat sp_putn sys_mmap ↻

structs

none

consts

12const K_MAGIC_1024: i64 = 1024

functions

14func sp_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 sp_putn(v: i64) -> i64
called by 1: main calls 3: sys_mmapccz_cat_numsys_write
23func sp_streq(a: *u8, b: *u8) -> i64
called by 1: main
30func main(argc: i64, argv: *i64) -> i64