wait4 on x64
wait for process to change state, BSD style
sys_wait4(pid_t pid, int *stat_addr, int options, struct rusage *ru)
| number | 61 (0x3d) |
|---|---|
| abi | common |
| entry point | sys_wait4 |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | wait4(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 61, the syscall number |
rdi | pid_t pid |
rsi | int *stat_addr |
rdx | int options |
r10 | 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 114
- arm64 260
- arm 114
- riscv64 260
- ia32 114
- x32 1073741885
- loongarch64 260
- ppc64 114
- ppc 114
- s390x 114
- mips64 5059
- mipsn32 6059
- mipso32 4114
- alpha 365
- arc 260
- blackfin 114, removed in 4.17
- cris 114, removed in 4.17
- csky 260
- frv 114, removed in 4.17
- hexagon 260
- ia64 1126, removed in 6.7
- m32r 114, removed in 4.17
- m68k 114
- metag 260, removed in 4.17
- microblaze 114
- mn10300 114, removed in 4.17
- nds32 260, removed in 5.18
- nios2 260
- openrisc 260
- parisc 114
- score 260, removed in 4.17
- sh 114
- sparc 7
- sparc64 7
- tilegx 260, removed in 4.17
- tilepro 260, removed in 4.17
- xtensa 121
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/wait4