code wiki / _hdl_build / nx_polite_daemon.nx

nx_polite_daemon.nx

buildroot/runtime/_hdl_build/nx_polite_daemon.nx

5738 B92 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind servicetopic polite
docsdependenciesstructsconstsfunctions

about

nx_polite_daemon.nx -- the team's CONTINUOUS, HOSTING-AWARE autonomous backlog loop. KEPT SMALL so the (currently toy-level) sovereign compiler builds it deterministically -- the live-monitor PAGE is built SEPARATELY by the website builder (backlog refactor), reading this loop's heartbeat. Each beat: sense the host (nx_sysload: load, cpu, free mem, live :8443 conns) -> governor (nx_resource_governor) decides SERVE-FIRST pause (yield to live hosting) / minimal / run -> compose-or-raise-hand -> append a HEARTBEAT to /tmp/nishi_loop_status.log -> sleep. Stop via /tmp/nishi_loop_stop. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_sysload.nx nx_resource_governor.nx nx_syscalls.nx nx_polite_daemon.nx

imports: nx_sysload.nxnx_resource_governor.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap sys_openat_append pd_fw sys_write sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sl_loadavg_milli sys_mmap ↻ sys_read_file ↻ sl_ncpu sys_mmap ↻ sys_read_file ↻ sl_count_substr sl_freemem_mb sys_mmap ↻ sys_read_file ↻ sl_active_conns_8443 sys_mmap ↻ sys_read_file ↻ sl_count_substr ↻ rg_hosting_reserve rg_hosting_ceil_milli rg_serve_first rg_should_backoff rg_memory_ok rg_worker_budget pd_fn sys_mmap ↻ sys_write ↻ pd_reach sys_fork sys_execve sys_exit sys_wait4 sys_sleep_ms

structs

none

consts

16const PL_RESERVE: i64 = 1
17const PL_MEM_FLOOR_MB: i64 = 1024
18const PL_INTERVAL_MS: i64 = 60000
19const PL_MAXTICKS: i64 = 100000
20const NTYPE: i64 = 8
21const NP: i64 = 8
22const NTASK: i64 = 6

functions

11func pd_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
calls 1: sys_write
12func pd_n(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1}; sys_write(1,b,k); return 0 }
13func pd_fw(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
14func pd_fn(fd: i64, v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1}; sys_write(fd,b,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
24func pd_reach(tin: i64, tout: i64, pin: *i64, pout: *i64, pav: *i64, reach: *i64) -> i64
called by 1: main
32func main() -> i64