lstat on x64
get file status
sys_newlstat(const char *filename, struct stat *statbuf)
| number | 6 (0x6) |
|---|---|
| abi | common |
| entry point | sys_newlstat |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | lstat(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 6, the syscall number |
rdi | const char *filename |
rsi | struct stat *statbuf |
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 107
- arm 107
- ia32 107
- x32 1073741830
- ppc64 107
- ppc 107
- s390x 107
- mips64 5006
- mipsn32 6006
- mipso32 4107
- alpha 68
- blackfin 107, removed in 4.17
- cris 107, removed in 4.17
- frv 107, removed in 4.17
- ia64 1211, removed in 6.7
- m32r 107, removed in 4.17
- m68k 107
- microblaze 107
- mn10300 107, removed in 4.17
- parisc 84
- score 1050, removed in 4.17
- sh 107
- sparc 40
- sparc64 40
- xtensa 49
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/lstat