code wiki / (root) / nx_budget_alloc_test.nx

nx_budget_alloc_test.nx

buildroot/runtime/nx_budget_alloc_test.nx

5693 B129 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic budget
docsdependenciesstructsconstsfunctions

about

nx_budget_alloc_test.nx -- smoke for sovereign ceiling enforcement. Exercises: 1. Allocations within budget succeed; ram_used increments correctly 2. Allocation that WOULD exceed ceiling returns NULL; ram_used unchanged (refusal BEFORE sys_mmap) 3. Verdict-returning variant distinguishes OVER vs BAD_KIND vs OK 4. release_logical decrements ram_used; subsequent allocations succeed up to fresh headroom 5. Multiple kinds enforce independently (RAM ceiling does not block VRAM allocation and vice versa) 6. Bad-input gates: null budget, zero size, negative size 7. Sealed-enum verdict gate 8. headroom() reflects state across allocations + releases Pure substrate: no /sys/fs/cgroup, no kernel cgroups, no Linux- only assumptions. Same code path runs on every host.

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_budget.nx nx_budget_alloc.nx nx_budget_alloc_test.nx

imports: nx_syscalls.nxnx_budget.nxnx_budget_alloc.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_budget_new sys_mmap nx_budget_mmap nx_budget_request nx_res_kind_is_valid sys_mmap ↻ nx_budget_release nx_res_kind_is_valid ↻ nx_budget_alloc_remaining nx_budget_remaining sys_mmap ↻ nx_budget_mmap_with_verdic nx_budget_mmap ↻ nx_budget_request ↻ sys_mmap ↻ nx_budget_release ↻ nx_budget_release_logical nx_budget_release ↻ nx_budget_alloc_verdict_is

structs

none

consts

none

functions

23func main() -> i64