code wiki / (root) / nx_execsurface.nx

nx_execsurface.nx

buildroot/runtime/nx_execsurface.nx

45298 B813 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_execsurface.nx -- WHICH SURFACE RUNS THIS PROGRAM? The execution-surface census for PROMOTED organs (2026-08-23, compare CE2, operator: no false ceilings). THE FALSE CEILING THIS CLOSES: the adoption ladder's INVOKED axis reads knowledge/status/actlog.jrnl, which records MCP-surface invocations ONLY. A program the clock plane fires nightly, a cron row, a daemon supervisor, the gate roster, or a ./x.elf fork from another organ therefore read REGISTERED-DARK ("no MCP invocation on record") while executing every day -- measured on the live graphics board: 12 of 19 PARTIAL rows, among them organs gates fork on every beat. nx_gateadjudicate solved exactly this for GATES by joining the gate population to the surfaces that CAUSE EXECUTION; nobody did it for programs. THE MCP REGISTRY IS NOT THE ONLY DOOR, AND A LADDER THAT ONLY WATCHES ONE DOOR CALLS EVERY OTHER ENTRANT DARK. THE EDGE DEFINITION IS THE QUESTION (gateadjudicate's law, measured 08-07: four definitions gave 75 / 0 / 2,043 / 30). A program counts as ON A SURFACE only through something that CAUSES execution: CLOCK the live clocksched- plane names its .elf in the organ column, split at spaces so an organ named in another row's ARGUMENTS (nx_sov_build_run.elf <gate>) counts too CRON a cron.reg row names <n>.elf, <n>.sh or <n>.cron.sh (shell wrappers spawn the organ) PLAN a clock row runs nx_plan_run.elf <id>: every tool the rows of knowledge/store/plan-<id>- name is credited (2026-09-17; the clock row is the cause, the plan the route -- workflows-as-data are a surface, and before this every plan-run organ read REGISTERED-DARK, measured on nx_search_ship) DAEMON a daemons.reg row's argv names <n>.elf (the supervisor keeps it alive) ROSTER a row of a ROSTER CONF names it (a beat of nx_gate_roster_run forks it): the runner's default knowledge/gateroster.conf and every conf a live clock row runs through nx_gate_roster_run beat, whatever journal that beat writes, derived from the plane by nx_rosterconf_lib and read with the beat's own row grammar (2026-09-18: the heavy roster's gates read roster=0 while its beat ran them daily; a later roster is read by declaring its clock row, with no edit here). A slow beat writing its own journal is credited like any other: the close ruler reads each roster's evidence from that roster's journal; the stamp still counts those beats (roster_beats_other_journal) ACTLOG the MCP tail window mentions it (the one door the ladder already watched) FORK another organ's SOURCE carries the string literal "./<n>.elf", "../<n>.elf" or "_offc/<n>.elf" AND that caller is itself on a surface -- 2-hop, iterated to a fixed point, so a beat-run organ that forks a helper that forks a third credits the third. A literal in a caller that is NOT on any surface is a REF: something wants it, nothing runs it. A MERE MENTION IS NOT INVOCATION. The literal must open a string ("./x.elf), so prose in a comment cannot credit a fork. ROWS name<TAB>clock<TAB>cron<TAB>daemon<TAB>fork<TAB>roster<TAB>actlog<TAB>first_surface clock/cron/daemon/roster/actlog are 0|1; fork is "-" or the first crediting caller's basename; first_surface is clock|cron|daemon|roster|actlog|plan|fork:<caller>|ref:<caller>|- (the token a board prints) LAST LINE (the canonical stamp, anchored BY POSITION; consumers never grep the rows for it): # asof=<epoch> organs=N on_surface=A ref_only=B dark=C sources=clock:<rows>,cron:<rows>,daemon:<rows>, roster:<rows>,roster_confs:<read>,roster_beats:<n>,roster_beats_other_journal:<n>,actlog:<bytes>,fork_files:<n>,

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_tool_run.nx nx_rosterconf_lib.nx nx_execsurface.nx

imports: nx_syscalls.nxnx_tool_run.nxnx_rosterconf_lib.nx

imported by: nobody (leaf or entry point)

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

main es_eq es_who sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ es_read sys_openat_rd sys_lseek sys_close sys_mmap ↻ sys_read es_puts sys_write ↻ esw_key_at esw_field es_eq ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real es_putn sys_mmap ↻ es_catn sys_mmap ↻ sys_munmap sys_write ↻ sys_munmap ↻ sys_write ↻

structs

none

consts

54const ES_DEC_MAX: i64 = 20
55const ES_NAME_CAP: i64 = 128 // one organ basename; a longer name is refused and counted
56const ES_DIRBUF: i64 = 131072 // one getdents64 window (looped until 0, so no listing is a prefix)
57const ES_PATHCAP: i64 = 4096 // Linux PATH_MAX
58const ES_ROW_FIXED: i64 = 16 + 2 * ES_NAME_CAP // tabs, five flags, "fork:" + caller, newline
59const ES_TAIL_FIXED: i64 = 512
60const ES_ACT_TAIL: i64 = 4194304 // the same tail window nx_catalog reads (declared in the stamp)
61const ES_PLANE_CAP: i64 = 1048576 // captured stdout of nx_store_put load: a pipe has no knowable size; ANNOUNCED if it fills
62const ES_MIN_LIT: i64 = 9 // the shortest fork literal: "./x.elf" plus its opening quote
140const ES_F_CLOCK: i64 = 0
141const ES_F_CRON: i64 = 1
142const ES_F_DAEMON: i64 = 2
143const ES_F_ROSTER: i64 = 3
144const ES_F_ACTLOG: i64 = 4
145const ES_F_FORK: i64 = 5 // index of the crediting caller organ, -1 none
146const ES_F_REF: i64 = 6 // index of the first caller organ that merely names it, -1 none
147const ES_F_PLAN: i64 = 7 // 1 = a clock row runs nx_plan_run <id> and that plan's rows name this organ
148const ES_F_N: i64 = 8
403const ES_PLAN_PFX: *u8 = "knowledge/store/plan-"
404const ES_PLAN_RUNNER: *u8 = "nx_plan_run"
478const ESW_STAMP_KEY: *u8 = "# asof="
479const ESW_BEAT_S: i64 = 86400 // the clock row's declared cadence for this census (execsurface 86400)
480const ESW_STALE_FACTOR: i64 = 2 // two missed beats = STALE, the same bound the cron watch uses

functions

64func es_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 2: es_whomain calls 1: sys_write
65func es_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
66func es_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } d[p] = 0 as u8; return p }
called by 2: es_credit_planmain
67func es_catn(d: *u8, o: i64, v: i64) -> i64
called by 2: es_putnmain calls 2: sys_mmapsys_munmap
81func es_putn(v: i64) -> i64 { let b: *u8 = sys_mmap(ES_DEC_MAX + 4); let n: i64 = es_catn(b, 0, v); sys_write(1, b, n); sys_munmap(b, ES_DEC_MAX + 4); return 0 }
82func es_eq(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 }
83func es_ends(s: *u8, sfx: *u8) -> i64
91func es_isdotdot(nm: *u8) -> i64
called by 2: es_list_elfses_walk
96func es_read(path: *u8, lp: *i64) -> *u8
118func es_read_tail(path: *u8, cap: i64, lp: *i64) -> *u8
150func es_name(arena: *u8, off: *i64, i: i64) -> *u8 { return ((arena as i64) + off[i]) as *u8 }
called by 2: es_findmain
152func es_find(arena: *u8, off: *i64, n: i64, name: *u8) -> i64
158func es_organ_token(tok: *u8, out: *u8) -> i64
182func es_credit_tokens(line: *u8, lstart: i64, lend: i64, arena: *u8, off: *i64, n: i64, st: *i64, f: i64) -> i64
203func es_credit_file(b: *u8, bn: i64, arena: *u8, off: *i64, n: i64, st: *i64, f: i64, rows_out: *i64) -> i64
called by 1: main calls 1: es_credit_tokens
223func es_credit_roster(b: *u8, bn: i64, arena: *u8, off: *i64, n: i64, st: *i64, rows_out: *i64) -> i64
250func es_list_elfs(dir: *u8, arena: *u8, aused: *i64, acap: i64, off: *i64, n: *i64, ncap: i64, toolong: *i64) -> i64
292func es_count_entries(dir: *u8) -> i64
313func es_walk(pass: i64, path: *u8, path_n: i64, arena: *u8, off: *i64, n: i64, esrc: *i64, edst: *i64, ecap: i64, st2: *i64) -> i64
405func es_sep(c: i64) -> i64 { if c == 32 { return 1 } if c == 9 { return 1 } if c == 124 { return 1 } if c == 10 { return 1 } return 0 }
called by 1: es_credit_plan
406func es_credit_plan(line: *u8, lstart: i64, lend: i64, arena: *u8, off: *i64, n: i64, st: *i64, plans: *i64) -> i64
459func es_on_surface(st: *i64, i: i64) -> i64
called by 1: main
482func esw_key_at(b: *u8, n: i64, i: i64, key: *u8) -> i64
called by 1: es_who
491func esw_field(row: *u8, n: i64, idx: i64, out: *u8, cap: i64) -> i64
called by 1: es_who
504func es_who(name: *u8, census: *u8) -> i64
573func main(argc: i64, argv: *i64) -> i64