Sixty-five headers sat side by side in include/, so `#include "irq.h"` said nothing about where irq.h was or what it belonged to, and errno.h, stat.h and fcntl.h at the top shadowed the system's for any host tool built with -I./include. They are in folders now -- arch/ core/ fs/ dev/ gfx/ net/ uapi/ (and ldls/ for the Linux driver layer) -- and every include names the folder, as Linux's do: "core/proc.h". Done mechanically and checked the hard way: the kernel built from this tree disassembles identically to the one built from the tree before it. The full image boots, and userland is the same set of programs. Paths in docs and comments follow; docs/guides/layout.md has a table of what is where, and tools/fix-includes.py rewrites old-style includes from the folders in the tree, for code written before this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
36 lines
1.5 KiB
Markdown
36 lines
1.5 KiB
Markdown
---
|
|
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.
|