AntOS Library — sys (reference)

The sys library's design and native core — task/memory/uptime introspection, direct memory access, and system control. The script-facing API is luau_sys.

What it is

sys is a consolidation, not a port of one P4 library. It gathers the genuinely-system facts that the ESP32-P4 had scattered: uptime and heap (were on os), tasks (were the FreeRTOS rtos library), and peek/poke (was the mem library) — plus the event log and A/B image state.

Design notes

  • This is where uptime and memory live, deliberately not on os — so os.clock() keeps its reference process-CPU-seconds meaning, and monotonic time (the P4's mis-defined os.clock) has a correct home in sys.monotonic.
  • The rtos FreeRTOS primitives are dropped, not ported. Queues, semaphores, mutexes, event groups, software timers, and tick math were kernel-specific; on Linux they are misconceived. sys keeps only the task view (list, inspect, spawn, wait, kill, priority), which maps cleanly to Linux processes/threads. Lua code uses coroutines and the OS for the rest.
  • sys.mem is bounds-checked by construction — the core validates every address against the permitted ranges before touching memory, so a bad poke returns nil, err instead of faulting the process.
  • Under Linux on the CM, task/memory calls wrap procfs/scheduler and meminfo; the event ring buffer and A/B image state come from the firmware layer.

Native cores

libantos_sys wraps the Linux introspection (procfs, meminfo), the event ring buffer, and the A/B image state; the folded-in sys_mem provides the range-checked memory window. No Luau dependency — the same cores back the console commands and the OLED/debug surfaces.

Related

Important: The Ant64 family of home computers are at early design/prototype stage, everything you see here is subject to change.