nx_pe_container_gen.nx
buildroot/runtime/nx_pe_container_gen.nx
about
nx_pe_container_datachar.nx -- generalized Job-Object container (OCI process.args/cwd via cmdline):
runs Elder data-character (python uvicorn :8100) as a governed child, no bash, no Docker.
Derived from nx_pe_container_sdserver; only the .data cmdline + output path differ. Original header:
nx_pe_container_win_io.nx -- W4-b-1: a governed Nishi container with WIRED stdout.
W4-a (nx_pe_container_win) ran a Nishi organ as a Job-governed child and reaped exit 88, but the
organ's "NX" stdout was lost (CreateProcessW used bInheritHandles=FALSE + CREATE_NO_WINDOW). This
rung wires container output: the child inherits the supervisor's stdout, so the organ's output is
CAPTURED -- making the container usable for real services that log to stdout (Elder-AI svcs do).
CHANGE vs W4-a (two immediates only; everything else byte-identical):
- CreateProcessW arg5 bInheritHandles: FALSE(0) -> TRUE(1) ([rsp+0x20])
- CreateProcessW arg6 dwCreationFlags: CREATE_NO_WINDOW(0x08000000) -> 0 ([rsp+0x28])
With handle inheritance on and no NO_WINDOW, the child (console app) inherits the supervisor's
stdout handle, so its writes flow to wherever the supervisor's stdout points (console or file).
Pipeline (same governed run+reap as W2c/W4-a): CreateJobObjectW -> SetInformationJobObject(limit=8)
-> AssignProcessToJobObject(self,-1) -> CreateProcessW("nx_win_compiled_organ.exe", inherit=TRUE,
flags=0) -> WaitForSingleObject(INFINITE) -> GetExitCodeProcess -> ExitProcess(childExit).
NO-FALSE-GREEN: the organ prints "NX\n" and exits 88. With output wired, BOTH must hold: stdout
captures "NX" (container output flows out) AND supervisor exit == 88 (governed child reaped). The
W4-a non-existent-child control (-> exit 0, rep-stosq-25 zeroes exitCode) still applies.
lineage_id: substrate_pe_container_win_io_v1 (evolves substrate_pe_container_win_v1).
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_hal.nxnx_pe_writer.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 30 | const PE_MAGIC_1024: i64 = 1024 |
| 32 | const PE_CWIO_FILE_SIZE: i64 = 0xA00 // enlarged: .data 0x400 holds sd-server's long cmdline; .idata shifted to file 0x800 (RVA fixed) |
functions
| 34 | func nxcwio_put_utf16(buf: *u8, off: i64, s: *u8) -> i64 |
| 44 | func nx_pe_emit_container_io(buf: *u8, cmd: *u8) -> i64 |
| 190 | func gen_puts(s: *u8) -> i64 { var k: i64 = 0; while s[k] != (0 as u8) { k = k + 1 } sys_write(1, s, k); return 0 } |
| 192 | func gen_emit_one(cmd: *u8, outpath: *u8) -> i64 |
| 203 | func main() -> i64 |