getrusage on x64
get resource usage
sys_getrusage(int who, struct rusage *ru)
| number | 98 (0x62) |
|---|---|
| abi | common |
| entry point | sys_getrusage |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | getrusage(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 98, the syscall number |
rdi | int who |
rsi | struct rusage *ru |
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 77
- arm64 165
- arm 77
- riscv64 165
- ia32 77
- x32 1073741922
- loongarch64 165
- ppc64 77
- ppc 77
- s390x 77
- mips64 5096
- mipsn32 6096
- mipso32 4077
- alpha 364
- arc 165
- blackfin 77, removed in 4.17
- cris 77, removed in 4.17
- csky 165
- frv 77, removed in 4.17
- hexagon 165
- ia64 1086, removed in 6.7
- m32r 77, removed in 4.17
- m68k 77
- metag 165, removed in 4.17
- microblaze 77
- mn10300 77, removed in 4.17
- nds32 165, removed in 5.18
- nios2 165
- openrisc 165
- parisc 77
- score 165, removed in 4.17
- sh 77
- sparc 117
- sparc64 117
- tilegx 165, removed in 4.17
- tilepro 165, removed in 4.17
- xtensa 190
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/getrusage