poll on x64
wait for some event on a file descriptor
sys_poll(struct pollfd *ufds, unsigned int nfds, int timeout_msecs)
| number | 7 (0x7) |
|---|---|
| abi | common |
| entry point | sys_poll |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | poll(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 7, the syscall number |
rdi | struct pollfd *ufds |
rsi | unsigned int nfds |
rdx | int timeout_msecs |
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 168
- arm 168
- ia32 168
- x32 1073741831
- ppc64 167
- ppc 167
- s390x 168
- mips64 5007
- mipsn32 6007
- mipso32 4188
- alpha 94
- cris 168, removed in 4.17
- frv 168, removed in 4.17
- ia64 1090, removed in 6.7
- m32r 168, removed in 4.17
- m68k 168
- microblaze 168
- mn10300 168, removed in 4.17
- parisc 168
- score 1068, removed in 4.17
- sh 168
- sparc 153
- sparc64 153
- xtensa 16
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/poll