nx_diskfree.nx
buildroot/runtime/nx_diskfree.nx
about
nx_diskfree.nx -- THE DISK AXIS, made callable (2026-08-28).
WHY THIS EXISTS. On 2026-08-28 a 100%-FULL DISK truncated a sibling seat's MEMORY.md to 0 bytes:
open(path,"w") truncates BEFORE it writes, so a full volume does not refuse a write, it DESTROYS the
file. Nothing in the estate saw it coming. nx_resmon is "the resource axis nx_health lacks" -- but only
for MEMORY and SWAP; a search for the disk primitive returned matches=0 for BOTH sys_statfs and statvfs
with corpus_complete=1, and nx_res_census records the same absence in its own header.
THE CAPABILITY WAS DARK, NOT MISSING. nx_system_triage.tr_free_gb has read filesystem space since
2026-06-10 -- inside an _hdl_build organ that is NOT REGISTERED, so nx_job_run refuses it as "not an
unpinned GREEN tool" and no caller in the estate can reach it. ★A CAPABILITY THAT EXISTS IN ONE
UNREACHABLE ORGAN IS INDISTINGUISHABLE FROM ONE NOBODY BUILT -- and its absence is only discovered by
the incident it would have prevented.
This organ is the reachable form. The arithmetic lives in nx_syscalls (sys_fs_used_permil /
sys_fs_avail_bytes) so nx_resmon can compose the SAME ruler rather than growing a second one.
THE THIRD STATE IS LOAD-BEARING. statfs can fail (bad path, unmounted, permission) and a volume can
report zero blocks. Both return STATFS_ERR and this organ prints UNMEASURABLE with exit 3 -- it never
prints 0 permil used, because "I could not look" and "the disk is empty" must never share a
representation, and 0-used is the most flattering possible lie.
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
| 26 | const DF_EXIT_UNMEASURABLE: i64 = 3 |
| 27 | const DF_EXIT_USAGE: i64 = 2 |
functions
| 29 | func df_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 30 | func df_num(v: i64) -> i64 |
| 44 | func main(argc: i64, argv: *i64) -> i64 |