code wiki / _hdl_build / nx_pub_serve.nx

nx_pub_serve.nx

buildroot/runtime/_hdl_build/nx_pub_serve.nx

5276 B115 linesdepth 6pulls 10 transitivereach 4 importersview sourcekind servicetopic pub
docsdependenciesstructsconstsfunctions

about

nx_pub_serve.nx -- PUB-SERVE R0: the publisher's OWN sovereign static-content HTTP server. It serves the publisher's liveroot as static files (GET /<path> -> liveroot/<path>), so PUBLISHING IS A FILE-DROP + SERVE -- NO sites.elf daemon-swap, no live-touching a fragile compiled daemon. New content = a new file in liveroot, served immediately. Sovereign (our own socket syscalls + HTTP/1.1 text; no nginx/3rd-party). Path-traversal is refused at the boundary (rule #12). This is the rung that lets THE PUBLISHER manage serving end to end. usage: nx_pub_serve <liveroot> <port>. Exposes psv_listen() so a gate can fork it on loopback. license_tier: ORIGINAL

dependencies 2 imports · 4 importers

nx_syscalls.nx nx_publisher.nx nx_pub_serve.nx nx_hostop_serve_gate.nx nx_pub_canary_gate.nx nx_pub_serve_gate.nx nx_pub_smoke_gate.nx

imports: nx_syscalls.nxnx_publisher.nx

imported by: nx_hostop_serve_gate.nxnx_pub_canary_gate.nxnx_pub_serve_gate.nxnx_pub_smoke_gate.nx

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

main psv_listen sys_mmap sys_socket sys_setsockopt sys_bind sys_listen sys_accept sys_fork sys_close sys_read psv_handle sys_mmap ↻ psv_path psv_send_status sys_mmap ↻ fa_cat fa_catn sys_mmap ↻ sys_write psv_safe pub_join pub_pcat sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read ↻ sys_close ↻ psv_send_ok sys_mmap ↻ fa_cat ↻ fa_catn ↻ sys_write ↻ sys_exit sys_wait4

structs

none

consts

9const K_MAGIC_1024: i64 = 1024
10const K_MAGIC_1280: i64 = 1280
11const K_MAGIC_16384: i64 = 16384
12const K_MAGIC_18620: i64 = 18620

functions

15func psv_path(req: *u8, rn: i64, out: *u8) -> i64
called by 1: psv_handle
39func psv_safe(path: *u8) -> i64
called by 1: psv_handle
47func psv_send_ok(cfd: i64, data: *u8, len: i64) -> i64
56func psv_send_status(cfd: i64, code: i64, msg: *u8) -> i64
64func psv_handle(cfd: i64, liveroot: *u8, req: *u8, rn: i64) -> i64
77func psv_listen(liveroot: *u8, port: i64) -> i64
109func main(argc: i64, argv: *i64) -> i64
calls 1: psv_listen