code wiki / (root) / nx_clock_driver_toolrun_ar.nx

nx_clock_driver_toolrun_ar.nx

buildroot/runtime/nx_clock_driver_toolrun_ar.nx

32853 B626 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind librarytopic clock
docsdependenciesstructsconstsfunctions

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 · 1 importers

nx_syscalls.nx nx_clock_driver_boundary_ar.nx nx_clock_driver_toolrun_ar.nx nx_clock_driver_gate_ar.nx

imports: nx_syscalls.nxnx_clock_driver_boundary_ar.nx

imported by: nx_clock_driver_gate_ar.nx

structs

none

consts

15const TR_EINTR: i64 = 0 - 4
17const TR_EINTR_MAX: i64 = 4096
34const TR_EXIT_EXECFAIL: i64 = 127
35const TR_MODE_0644: i64 = 420
197const TR_ERR_TIMEOUT: i64 = 0 - 5
198const TR_SIGKILL: i64 = 9
310const TR_PROMOTE: i64 = 0 - 7 // distinct from TR_ERR_TIMEOUT (-5) and TR_ERR_CHDIR (-6)
311const TR_POLLFD_BYTES: i64 = 8 // sizeof(struct pollfd)
312const TR_POLLIN: i64 = 1 // POLLIN
313const TR_PF_EV_OFF: i64 = 4 // offsetof(struct pollfd, events)
314const TR_PF_RE_OFF: i64 = 6 // offsetof(struct pollfd, revents)
315const TR_PF_FD_BYTES: i64 = 4 // sizeof(i32 fd)
316const TR_BITS_PER_BYTE: i64 = 8
317const TR_BYTE_MASK: i64 = 0xff
413const TR_ERR_CHDIR: i64 = 0 - 6
507const TR_FIT: i64 = 0
508const TR_CUT: i64 = 1

functions

37func tr_exec_failed(path: *u8) -> i64
83func tr_run_redirect(path: *u8, argv: *i64, out_path: *u8, err_path: *u8) -> i64
121func tr_run_capture(path: *u8, argv: *i64, out: *u8, cap: i64, outlen: *i64) -> i64
202func tr_run_capture_to(path: *u8, argv: *i64, out: *u8, cap: i64, outlen: *i64, timeout_ms: i64) -> i64
318func tr_pollfd_set(p: *u8, fd: i64) -> i64
330func tr_run_capture_deadline(path: *u8, argv: *i64, out: *u8, cap: i64, outlen: *i64, deadline_ms: i64, out_pid: *i64, out_rfd: *i64) -> i64
414func tr_run_capture_cwd(path: *u8, argv: *i64, out: *u8, cap: i64, outlen: *i64, timeout_ms: i64, cwd: *u8) -> i64
509func tr_drain_tr(rfd: i64, out: *u8, cap: i64, trunc: *i64) -> i64
called by 1: tr_run_capture_tr calls 2: sys_readsys_mmap
539func tr_run_capture_tr(path: *u8, argv: *i64, out: *u8, cap: i64, outlen: *i64, timeout_ms: i64, trunc: *i64) -> i64
596func tr_run1(path: *u8, arg: *u8, out: *u8, cap: i64, outlen: *i64) -> i64
604func tr_run1_to(path: *u8, arg: *u8, out: *u8, cap: i64, outlen: *i64, timeout_ms: i64) -> i64
612func tr_contains(buf: *u8, n: i64, needle: *u8) -> i64