code wiki / (root) / nx_proc_spawn.nx

nx_proc_spawn.nx

buildroot/runtime/nx_proc_spawn.nx

7651 B166 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind orphan librarytopic proc
docsdependenciesstructsconstsfunctions

about

nx_proc_spawn.nx -- HIGH-LEVEL spawn-with-capability-gate layer above the FULLY_WIRED nx_proc.nx primitive (fork/exec/wait4 syscall wrappers). AUDIT-FIRST CORRECTION (2026-05-20, post-creation): user caught that I built this without checking for existing prior art. nx_proc.nx already ships with nx_proc_fork / nx_proc_execve / nx_proc_wait4 / wait-status inspectors. This primitive does NOT duplicate those -- it adds the capability-token + priv-class + log-redirect layer ABOVE them. When graduated, nx_proc_spawn_execute will CALL nx_proc_fork + nx_proc_execve internally; it is the supervised wrapper, not a competing implementation. Per feedback-no-temporary-third-party-scaffolding-when-substrate-arc-exists audit-first rule: ls nxc2/runtime/ before authoring new primitives. Composes with the existing nx_supervisor state-machine primitive (which decides what to do); THIS primitive does the actual process management. module: nishi-core.ops.proc_spawn depends: nishi-core.perception.profile + nishi-core.ops.supervisor + nishi-core.io.syscalls disk_kb: 5 capability: OPS wired_status: PARTIAL_WIRED MISSING_CAPABILITIES: - FORK_EXEC_SETSID (sys_fork + sys_execve + sys_setsid; sys_fork is proven via nishi_video_room.nx, sys_execve glue needed) - CAPABILITY_TOKEN_VERIFY (content-addressed capability proof that replaces /etc/sudoers.d/* NOPASSWD entries with cryptographic capability bearer tokens; composes with nx_ed25519 + nx_blake2b which are FULLY_WIRED per status doc) - PRIV_DROP (after fork, child drops privilege per NX_SUPV_PRIV_* declared class before execve) - FD_HYGIENE (close-on-exec all inherited fds except declared ones) - STDIO_REDIRECT (per-child stdout/stderr to substrate-managed log files) license_tier: PUBLIC_NISHI_SUBSTRATE genealogy_id: feedback-no-temporary-third-party-scaffolding-when-substrate-arc-exists_2026 + feedback-substrate-does-heavy-lifting-user-is-partner-not-gate + nx_supervisor (existing state-machine primitive) + nx_daemon_health_audit

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_perceptual_profile.nx nx_supervisor.nx nx_proc_spawn.nx

imports: nx_syscalls.nxnx_perceptual_profile.nxnx_supervisor.nx

imported by: nobody (leaf or entry point)

structs

101struct NxPSpawnRequest

consts

60const NX_PSPAWN_OK: i64 = 0
61const NX_PSPAWN_SPAWNED: i64 = 1
62const NX_PSPAWN_FAIL_FORK: i64 = 2
63const NX_PSPAWN_FAIL_EXEC: i64 = 3
64const NX_PSPAWN_FAIL_BAD_BINARY: i64 = 4 // path missing / not exec
65const NX_PSPAWN_FAIL_CAPABILITY_REFUSED: i64 = 5 // requested priv exceeds
67const NX_PSPAWN_FAIL_PRIV_DROP: i64 = 6 // child couldn't drop priv
68const NX_PSPAWN_FAIL_DEPENDENCY_MISSING: i64 = 7 // PARTIAL_WIRED default
84const NX_PSPAWN_PRIV_USER: i64 = 1
85const NX_PSPAWN_PRIV_NET_BIND_LOW_PORT: i64 = 2
86const NX_PSPAWN_PRIV_FS_WRITE_PROTECTED: i64 = 3
87const NX_PSPAWN_PRIV_DEVICE_ACCESS: i64 = 4
88const NX_PSPAWN_PRIV_ROOT_FULL: i64 = 5 // audit-gate

functions

70func nx_pspawn_verdict_name(v: i64) -> *u8
90func nx_pspawn_priv_class_name(p: i64) -> *u8
125func nx_pspawn_execute(req_ptr: *NxPSpawnRequest) -> i64
134func nx_pspawn_kill_pid(pid: i64, grace_seconds: i64) -> i64
142func nx_pspawn_pid_is_alive(pid: i64) -> i64
151func nx_pspawn_verify_capability_token(token_ptr: *u8, token_len: i64,
164func nx_pspawn_get_last_verdict() -> i64