nx_tool_run_owned_candidate_t218.nx
buildroot/runtime/nx_tool_run_owned_candidate_t218.nx
about
nx_tool_run.nx -- R0 of the EXECUTABLE-API rung: the sovereign exec+capture primitive the ecosystem
is missing. Today nishifamily.com/api/tools + /mcp only LIST tools (a read-only registry) and MCP
tools/call returns a SAFE STUB ("invoked X (capability-authorized)") -- there is NO way to actually
RUN an organ and hand back its real stdout. This organ is that missing capability, built hardware-up
from raw syscalls (fork/pipe/dup3/execve/wait4), reusing the EXACT proven wrappers from nx_hostctl's
hc_dfork_exec so it inherits the same never-brick discipline. NO /bin/sh, NO shell string, NO PATH
search -- callers pass an ABSOLUTE ELF path (the allowlist layer that maps tool-name -> path is R1,
nx_tool_registry). Synchronous (wait4), unlike hc_dfork_exec's detach -- because an API tools/call
needs the child's OUTPUT and EXIT CODE, not a fire-and-forget daemon.
license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_buf_dyn_owned_candidate_t218.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 16 | const TR_ERR_DRAIN: i64 = 0 - 8 |
| 17 | const TR_ERR_FD_SETUP: i64 = 0 - 12 |
| 18 | const TR_ERR_PARENT_LIFETIME: i64 = 0 - 11 |
| 19 | const TR_DRAIN_BYTES: i64 = 4096 |
| 21 | const TR_EINTR: i64 = 0 - 4 |
| 23 | const TR_EINTR_MAX: i64 = 4096 |
| 40 | const TR_EXIT_EXECFAIL: i64 = 127 |
| 41 | const TR_MODE_0644: i64 = 420 |
| 197 | const TR_ERR_TIMEOUT: i64 = 0 - 5 |
| 198 | const TR_SIGKILL: i64 = 9 |
| 231 | const TR_PROMOTE: i64 = 0 - 7 // distinct from TR_ERR_TIMEOUT (-5) and TR_ERR_CHDIR (-6) |
| 232 | const TR_POLLFD_BYTES: i64 = 8 // sizeof(struct pollfd) |
| 233 | const TR_POLLIN: i64 = 1 // POLLIN |
| 234 | const TR_PF_EV_OFF: i64 = 4 // offsetof(struct pollfd, events) |
| 235 | const TR_PF_RE_OFF: i64 = 6 // offsetof(struct pollfd, revents) |
| 236 | const TR_PF_FD_BYTES: i64 = 4 // sizeof(i32 fd) |
| 237 | const TR_BITS_PER_BYTE: i64 = 8 |
| 238 | const TR_BYTE_MASK: i64 = 0xff |
| 334 | const TR_ERR_CHDIR: i64 = 0 - 6 |
| 342 | const TR_FIT: i64 = 0 |
| 343 | const TR_CUT: i64 = 1 |
| 383 | const TR_CONTROL_BYTES: i64 = 4096 |
| 384 | const TR_ERR_GROUP: i64 = 0 - 9 |
| 385 | const TR_ERR_ALLOC: i64 = 0 - 10 |
| 386 | const TR_ECHILD: i64 = 0 - 10 // Linux errno, distinct from the public result namespace |
functions
| 43 | func tr_exec_failed(path: *u8) -> i64 called by 3: tr_run_capturetr_run_capture_deadlinetr_run_capture_core_owned calls 2: sys_writesys_exit |
| 89 | func tr_run_redirect(path: *u8, argv: *i64, out_path: *u8, err_path: *u8) -> i64 |
| 127 | func tr_run_capture(path: *u8, argv: *i64, out: *u8, cap: i64, outlen: *i64) -> i64 called by 2: tr_run_capture_deadlinetr_run1 calls 10: sys_mmapsys_pipe2sys_forksys_closesys_dup3sys_execve_clean+4 |
| 202 | func tr_run_capture_to(path: *u8, argv: *i64, out: *u8, cap: i64, outlen: *i64, timeout_ms: i64) -> i64 |
| 239 | func tr_pollfd_set(p: *u8, fd: i64) -> i64 |
| 251 | func tr_run_capture_deadline(path: *u8, argv: *i64, out: *u8, cap: i64, outlen: *i64, deadline_ms: i64, out_pid: *i64, out_rfd: *i64) -> i64 |
| 335 | func tr_run_capture_cwd(path: *u8, argv: *i64, out: *u8, cap: i64, outlen: *i64, timeout_ms: i64, cwd: *u8) -> i64 calls 1: tr_run_capture_core |
| 344 | func tr_drain_tr(rfd: i64, out: *u8, cap: i64, trunc: *i64) -> i64 |
| 377 | func tr_run_capture_tr(path: *u8, argv: *i64, out: *u8, cap: i64, outlen: *i64, timeout_ms: i64, trunc: *i64) -> i64 |
| 387 | func tr_clock_ms(ts: *i64) -> i64 called by 3: tr_drain_until_ownedtr_watchdog_childtr_run_capture_core_owned calls 1: sys_clock_gettime_mono |
| 392 | func tr_observe_exit(pid: i64, info: *u8) -> i64 |
| 397 | func tr_reap(pid: i64, status: *i64) -> i64 |
| 405 | func tr_drain_until(rfd:i64,out:*u8,cap:i64,trunc:*i64,outlen:*i64,deadline:i64)->i64 |
| 408 | func tr_drain_until_owned(rfd:i64,out:*u8,cap:i64,trunc:*i64,outlen:*i64,deadline:i64,owned:*NxBufOwned,max_bytes:i64)->i64 called by 2: tr_drain_untiltr_run_capture_core_owned calls 7: sys_mmaptr_clock_mstr_pollfd_setsys_pollsys_readnx_bo_append+1 |
| 461 | func tr_capture_stop(pid: i64, control: *i64) -> i64 |
| 469 | func tr_watchdog_child(owner: i64, pid: i64, control: *i64, deadline: i64, wfd: i64, scratch: *u8) -> i64 called by 1: tr_watchdog_start calls 8: sys_bind_parent_lifetimesys_dup3sys_closesys_close_inheritedsys_writetr_clock_ms+2 |
| 490 | func tr_watchdog_start(owner: i64, pid: i64, control: *i64, deadline: i64) -> i64 called by 1: tr_run_capture_core_owned calls 10: sys_mmapsys_pipe2sys_munmapsys_forktr_watchdog_childsys_exit+4 |
| 517 | func tr_run_capture_core(path:*u8,argv:*i64,out:*u8,cap:i64,outlen:*i64,timeout_ms:i64,trunc:*i64,cwd:*u8)->i64 |
| 522 | func tr_run_capture_owned(path:*u8,argv:*i64,owned:*NxBufOwned,timeout_ms:i64,max_bytes:i64,cwd:*u8)->i64 calls 1: tr_run_capture_core_owned |
| 528 | func tr_run_capture_core_owned(path:*u8,argv:*i64,out:*u8,cap:i64,outlen:*i64,timeout_ms:i64,trunc:*i64,cwd:*u8,owned:*NxBufOwned,max_bytes:i64)->i64 called by 2: tr_run_capture_coretr_run_capture_owned calls 21: sys_mmap_sharedtr_clock_mssys_munmapsys_pipe2sys_forksys_close+15 |
| 608 | func tr_run1(path: *u8, arg: *u8, out: *u8, cap: i64, outlen: *i64) -> i64 |
| 616 | func tr_run1_to(path: *u8, arg: *u8, out: *u8, cap: i64, outlen: *i64, timeout_ms: i64) -> i64 |
| 624 | func tr_contains(buf: *u8, n: i64, needle: *u8) -> i64 |