--- name: schunix-syscall-single-table description: Syscalls are declared once in kernel/sys/table.inc — never hand-edit linux_abi.c metadata: node_type: memory type: project originSessionId: d1a1ea76-f919-411c-b0ef-0e1bc5064563 modified: 2026-08-01T19:34:55.691Z --- Since 2026-08-01 a Schunix syscall is declared in exactly **one** place: ``` SYSCALL(nr, linux_nr, name) // kernel/sys/table.inc SYSCALL_ALIAS(linux_nr, name) // extra Linux number -> existing handler ``` and implemented as `SYSCALL_DEFINE(name) { ... }` in a `kernel/sys/sys_*.c`. Generated from that one line: the `SYS_*` enum (`include/core/syscall.h`), the dispatch table (`kernel/sys/syscall.c`), and the Linux ABI translation map (`kernel/sys/linux_abi.c`). **Why:** it used to take three edits in two files — a `table.inc` line, a `#define LINUX_foo N`, and a map entry. Forgetting the second file left the syscall unreachable from every musl-linked program while looking correctly registered. `linux_abi.c` went from 361 hand-written lines to 34 generated ones. **How to apply:** never add anything to `linux_abi.c` — there is nothing to edit there. `NO_LINUX` marks a syscall with no Linux equivalent; all such entries collide on scratch index 511, which is never dispatched. 184 syscalls, 150 with Linux numbers, 7 aliases (vfork→fork, preadv→readv, …). See [[schunix-linux-abi-decision]] — dropping the native ABI entirely is still the plan; this refactor is the prerequisite, not a replacement for it.