openat2 on x64
open and possibly create a file (extended)
sys_openat2(int dfd, const char *filename, struct open_how *how, size_t size)
| number | 437 (0x1b5) |
|---|---|
| abi | common |
| entry point | sys_openat2 |
| since | Linux 5.6 |
| man page | openat2(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 437, the syscall number |
rdi | int dfd |
rsi | const char *filename |
rdx | struct open_how *how |
r10 | size_t size |
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 437
- arm64 437
- arm 437
- riscv64 437
- ia32 437
- x32 1073742261
- loongarch64 437
- ppc64 437
- ppc 437
- s390x 437
- mips64 5437
- mipsn32 6437
- mipso32 4437
- alpha 547
- arc 437
- csky 437
- hexagon 437
- ia64 1461, removed in 6.7
- m68k 437
- microblaze 437
- nds32 437, removed in 5.18
- nios2 437
- openrisc 437
- parisc 437
- sh 437
- sparc 437
- sparc64 437
- xtensa 437
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/openat2