nx_cgroup_v2_probe.nx
buildroot/runtime/nx_cgroup_v2_probe.nx
about
nx_cgroup_v2_probe.nx -- Linux cgroups v2 host detection.
Stage A foundation per NISHI_ELDER_AI_OFF_DOCKER_2026_05_20.md.
To enforce nx_budget ceilings via the host kernel (memory.max,
pids.max, cpu.weight), the substrate must FIRST detect whether
cgroups v2 is available on the host. This primitive is the
inspection-only foundation; mutation primitives (mkdir cgroup,
write memory.max, attach pid) ship in a later session ON A
LINUX HOST where their smokes can actually run.
Detection works by attempting to read /sys/fs/cgroup/cgroup.controllers:
- File exists + readable: cgroups v2 is mounted; returns 1
- File missing / unreadable: cgroups v2 unavailable; returns 0
Host coverage:
Linux with cgroup v2 -> available()=1
Linux with cgroup v1 -> available()=0 (no v2 root)
Cygwin / Windows-mounted bash -> available()=0 (no /sys at all)
macOS -> available()=0 (no cgroups)
qemu-user-static -> passthrough to host kernel; if host
has cgroups v2, returns 1
HONEST scope this V1:
- Read-only probe; no mutation
- Single canonical file check (cgroup.controllers)
- No delegated-controllers parsing (queued)
- No process-self-cgroup parsing (queued; reads /proc/self/cgroup)
- No mutation primitives (queued for Linux-host session)
genealogy_id: linux_cgroup_v2_2018 + systemd_cgroup_delegation_2017 +
cardinal_2026-05-20_elder_ai_off_docker
lineage_id: substrate_cgroup_v2_probe_v1
nx_capability_manifest:
variant_class: cgroup_v2_probe
variant_id: cgroup_v2_probe_v1_read_only
requires_isa: [rv64imac, x86_64, aarch64]
requires_syscalls: [openat, read, close, mmap]
requires_ram_min_b: 4096
tier_floor: NX_TIER_INF_MOBILE
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_cgroup_v2_probe_test.nx
structs
| none |
consts
| 58 | const NX_CG_AVAILABLE: i64 = 1 |
| 59 | const NX_CG_UNAVAILABLE: i64 = 0 |
| 60 | const NX_CG_PROBE_BAD_INPUT: i64 = -1 |
functions
| 67 | func _cg_path_controllers(out: *u8) -> i64 |
| 111 | func nx_cgroup_v2_available() -> i64 |
| 135 | func nx_cgroup_v2_controllers(out_buf: *u8, max_len: i64) -> i64 |
| 160 | func nx_cg_verdict_is_valid(v: i64) -> i64 called by 1: main |