code wiki / _hdl_build / nx_fix_build.nx
nx_fix_build.nx source
↩ module page · 19 lines · 910 B
1// nx_fix_build.nx -- consolidation-applier gate FIXTURE (mock build). Reads a FIXED input file
2// /tmp/cab_input and writes its bytes to argv[1] (the artifact). If the input is absent, writes the
3// literal "MISSING" -> the artifact DEPENDS on the input's presence/content, so the gate can prove
4// the applier's byte-compare gate discriminates a live dependency from a dead one. exit 0 always.
5// license_tier: ORIGINAL No hw writes (Rule 26).
6import "nx_seg_store.nx"
7import "nx_deploy_lib.nx"
8import "nx_syscalls.nx"
9const K_MAGIC_65536: i64 = 65536
10
11func main(argc: i64, argv: *i64) -> i64 {
12 if argc < 2 { sys_exit(2); return 2 }
13 let art: *u8 = argv[1] as *u8
14 let buf: *u8 = sys_mmap(K_MAGIC_65536)
15 let n: i64 = dp_read("/tmp/cab_input" as *u8, buf, K_MAGIC_65536)
16 if n > 0 { ss_writefile(art, buf, n) } else { ss_writefile(art, "MISSING" as *u8, 7) }
17 sys_exit(0)
18 return 0
19}