展示 HN:我已更新我的 Linux 系统调用网站和 API
Show HN: I've updated my Linux System Call website and API

原始链接: https://syscall.sh/

本网站收集 27 种架构的 Linux 系统调用表,包括内核版本 3.3 至 7.3 的系统调用号、参数、寄存器和调用约定。每个架构的表可作为 JSON 获取(例如 /x64/syscalls.json),并记录系统调用的新增或移除时间。数据从内核源码提取,包括系统调用表和 SYSCALL_DEFINE 宏,描述则来自 Linux man 手册页和 liburing。已移除的系统调用仍可见,API 提供按版本查询和差异对比。

Hacker News 的帖子宣布更新了 Linux syscall 网站和 API(syscall.sh),新增架构、内核选择、描述和移动端改进。评论者讨论 syscall 细节:在 x86_64 上 syscall 号在 eax 中;syscall 号因 ABI 独立分配而因架构不同,尽管内核 API 通过 libc 可移植。网站数据直接来自内核源码并每周更新。其他话题包括使用编译器命令验证常量、过时或变体 syscall,如 pipe/pipe2 和 open/openat,以及 io_uring 作为许多 I/O 相关调用的现代替代。有人争论相似 syscall 是否应算作不同,指出很多是家族变体或过时但为兼容性仍受支持。作者可能会发布 CLI 工具。总体而言,帖子涵盖 syscall 参考工具和 Linux syscall ABI 演进。
相关文章

原文

Every Linux syscall table in one place, grouped by architecture: system calls for 27 architectures with their numbers, arguments and registers, from Linux 3.3 to 7.3.

Architectures

Every architecture's table, with the full history of when each syscall appeared and when it was dropped, is also a plain JSON file at /<arch>/syscalls.json, for example /x64/syscalls.json.

Calling conventions

Number in NR, arguments in ARG0 to ARG5, then the instruction. The result comes back in RETURN.

ARCHINSTRUCTIONNRRETURNARG0ARG1ARG2ARG3ARG4ARG5
x64syscallraxrax rdirsirdxr10r8r9
x86int 0x80eaxeax ebxecxedxesiediebp
arm64svc #0x8x0 x0x1x2x3x4x5
armsvc #0r7r0 r0r1r2r3r4r5
riscv64ecalla7a0 a0a1a2a3a4a5
ia32int 0x80eaxeax ebxecxedxesiediebp
x32syscallraxrax rdirsirdxr10r8r9
loongarch64syscall 0a7a0 a0a1a2a3a4a5
ppc64scr0r3 r3r4r5r6r7r8
ppcscr0r3 r3r4r5r6r7r8
s390xsvc 0r1r2 r2r3r4r5r6r7
mips64syscallv0v0 a0a1a2a3a4a5
mipsn32syscallv0v0 a0a1a2a3a4a5
mipso32syscallv0v0 a0a1a2a3sp+16sp+20
alphacallsysv0v0 a0a1a2a3a4a5
arctrap0r8r0 r0r1r2r3r4r5
cskytrap 0r7a0 a0a1a2a3r4r5
hexagontrap0(#1)r6r0 r0r1r2r3r4r5
m68ktrap #0d0d0 d1d2d3d4d5a0
microblazebrki r14,8r12r3 r5r6r7r8r9r10
nios2trapr2r2 r4r5r6r7r8r9
openriscl.sys 1r11r11 r3r4r5r6r7r8
pariscble 0x100(%sr2, %r0)r20r28 r26r25r24r23r22r21
shtrapa #31r3r0 r4r5r6r7r0r1
sparct 0x10g1o0 o0o1o2o3o4o5
sparc64t 0x6dg1o0 o0o1o2o3o4o5
xtensasyscalla2a2 a6a3a4a5a8a9

API

curl https://api.syscall.sh/v2/syscalls/x64/read

Any kernel release, diffs between releases and more in the API docs.

Syscall tables across kernel versions

Entries get added and, rarely, removed between releases. Each architecture page has a kernel selector, and its JSON download records when each entry first appeared (since) and when it was dropped (removed_in).

Removed entries stay visible: pick "all, with removed" in the kernel selector and each dropped syscall is marked with the release that dropped it.

Where the data comes from

Everything on this site is read from the kernel source itself. For each architecture, the generator walks the syscall table and the SYSCALL_DEFINE macros of every mainline release it scans, so these are the numbers the kernel actually dispatches on.

It also records each architecture's calling convention, the instruction that enters the kernel, so every syscall table shows exactly where the number and the arguments go.

A syscall whose since equals the first release scanned for its architecture was already there back then, and may be much older.

Descriptions and full history

The short descriptions come from the Linux man pages project, and the io_uring ones from liburing. Whenever the data changes, the site is rebuilt from the syscall API.

联系我们 contact @ memedata.com