AntOS Library — sys (reference)
The
syslibrary'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— soos.clock()keeps its reference process-CPU-seconds meaning, and monotonic time (the P4's mis-definedos.clock) has a correct home insys.monotonic. - The
rtosFreeRTOS primitives are dropped, not ported. Queues, semaphores, mutexes, event groups, software timers, and tick math were kernel-specific; on Linux they are misconceived.syskeeps 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.memis bounds-checked by construction — the core validates every address against the permitted ranges before touching memory, so a badpokereturnsnil, errinstead 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
- luau_sys — the script API · antos_os (time/clock split) · Firmware · Debug OLED · antos_library_design · AntOS Libraries hub