cachestat on x64
query the page cache statistics of a file
sys_cachestat(unsigned int fd, struct cachestat_range *cstat_range, struct cachestat *cstat, unsigned int flags)
| number | 451 (0x1c3) |
|---|---|
| abi | common |
| entry point | sys_cachestat |
| since | Linux 6.5 |
| man page | cachestat(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 451, the syscall number |
rdi | unsigned int fd |
rsi | struct cachestat_range *cstat_range |
rdx | struct cachestat *cstat |
r10 | unsigned int flags |
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 451
- arm64 451
- arm 451
- riscv64 451
- ia32 451
- x32 1073742275
- loongarch64 451
- ppc64 451
- ppc 451
- s390x 451
- mips64 5451
- mipsn32 6451
- mipso32 4451
- alpha 561
- arc 451
- csky 451
- hexagon 451
- ia64 1475, removed in 6.7
- m68k 451
- microblaze 451
- nios2 451
- openrisc 451
- parisc 451
- sh 451
- sparc 451
- sparc64 451
- xtensa 451
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/cachestat