code wiki / _hdl_build / nx_mtime_probe.nx
nx_mtime_probe.nx
buildroot/runtime/_hdl_build/nx_mtime_probe.nx
about
nx_mtime_probe.nx -- PROVES THE MISSING PRIMITIVE: file MODIFICATION TIME, which this ecosystem cannot
currently ask for at all. MEASURED 2026-07-30: `sys_stat` and `statx` have ZERO matches across all
19,813 tree files, so no organ can answer "is this file newer than that one?". That absence is why
/api/unpack cannot refuse to BACKDATE a canonical source (seq1379 half-2, the path that reverted
nx_hostctl.nx), why nx_stale_check must infer staleness indirectly, and why the GPU lane had to bank
the lesson "a file can GROW and still be OLDER" -- they had no clock to consult, only a size.
MECHANISM (no core-file surgery): syscall wrappers can be declared LOCALLY via the __syscall intrinsic
-- nx_movie_probe.nx already does exactly this for lseek. So the primitive costs ZERO blast radius on
nx_syscalls.nx, the tree's most load-bearing file (~14k importers).
newfstatat(AT_FDCWD, path, statbuf, 0) = syscall 262 on x86-64; in `struct stat` st_mtim.tv_sec sits at
BYTE OFFSET 88 (dev 0, ino 8, nlink 16, mode 24, uid 28, gid 32, pad 36, rdev 40, size 48, blksize 56,
blocks 64, atime 72, atime_ns 80, mtime 88). ⚠That offset is the ONLY assumption here, so this organ
EXISTS to falsify it: it prints size (offset 48, independently checkable) beside mtime, and the caller
compares both against `ls`. An offset that is wrong shows up instantly as a garbage epoch.
nx_mtime_probe <path> [<path2>] -> "MTIME <epoch> SIZE <bytes> <path>" per arg; NEWER=<path> verdict
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| 21 | const MP_AT_FDCWD: i64 = 0 - 100 |
| 22 | const MP_SYS_NEWFSTATAT: i64 = 262 |
| 23 | const MP_STATBUF: i64 = 256 |
| 24 | const MP_OFF_SIZE: i64 = 48 |
| 25 | const MP_OFF_MTIME: i64 = 88 |
functions
| 27 | func mp_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 28 | func mp_n(v: i64) -> i64 |
| 40 | func mp_stat(path: *u8, outs: *i64) -> i64 |
| 51 | func main(argc: i64, argv: *i64) -> i64 |