waitid on x64
wait for process to change state
sys_waitid(int which, pid_t pid, struct siginfo *infop, int options, struct rusage *ru)
| number | 247 (0xf7) |
|---|---|
| abi | 64 |
| entry point | sys_waitid |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | waitid(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 247, the syscall number |
rdi | int which |
rsi | pid_t pid |
rdx | struct siginfo *infop |
r10 | int options |
r8 | struct rusage *ru |
rax | the return value |
Then run syscall to enter the kernel.
The syscall instruction clobbers rcx (the return address lands in rcx) and r11 (the flags land in r11).
Since Linux 5.14 the kernel reads the syscall number from eax and ignores the upper 32 bits of rax. Older kernels fail with ENOSYS when those bits are not zero, and mov eax, N clears them, so it works on both.
Same syscall on other architectures
- x86 284
- arm64 95
- arm 280
- riscv64 95
- ia32 284
- x32 1073742353
- loongarch64 95
- ppc64 272
- ppc 272
- s390x 281
- mips64 5237
- mipsn32 6241
- mipso32 4278
- alpha 438
- arc 95
- blackfin 285, removed in 4.17
- cris 284, removed in 4.17
- csky 95
- frv 284, removed in 4.17
- hexagon 95
- ia64 1270, removed in 6.7
- m32r 284, removed in 4.17
- m68k 277
- metag 95, removed in 4.17
- microblaze 284
- mn10300 284, removed in 4.17
- nds32 95, removed in 5.18
- nios2 95
- openrisc 95
- parisc 235
- score 95, removed in 4.17
- sh 284
- sparc 279
- sparc64 279
- tilegx 95, removed in 4.17
- tilepro 95, removed in 4.17
- xtensa 122
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/waitid