select on x64
synchronous I/O multiplexing
sys_select(int n, fd_set *inp, fd_set *outp, fd_set *exp, struct __kernel_old_timeval *tvp)
| number | 23 (0x17) |
|---|---|
| abi | common |
| entry point | sys_select |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | select(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 23, the syscall number |
rdi | int n |
rsi | fd_set *inp |
rdx | fd_set *outp |
r10 | fd_set *exp |
r8 | struct __kernel_old_timeval *tvp |
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 82
- ia32 82
- x32 1073741847
- ppc 82
- s390x 142
- alpha 358
- cris 82, removed in 4.17
- ia64 1089, removed in 6.7
- m68k 82
- mn10300 82, removed in 4.17
- score 1067, removed in 4.17
- sparc 93
- sparc64 93
- xtensa 14
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/select