getrlimit on x64
get/set resource limits
sys_getrlimit(unsigned int resource, struct rlimit *rlim)
| number | 97 (0x61) |
|---|---|
| abi | common |
| entry point | sys_getrlimit |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | getrlimit(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 97, the syscall number |
rdi | unsigned int resource |
rsi | struct rlimit *rlim |
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 76
- arm64 163
- riscv64 163
- ia32 76
- x32 1073741921
- ppc 76
- s390x 191
- mips64 5095
- mipsn32 6095
- mipso32 4076
- alpha 144
- arc 163
- blackfin 191, removed in 4.17
- cris 76, removed in 4.17
- csky 163
- hexagon 163
- ia64 1085, removed in 6.7
- m68k 76
- metag 163, removed in 4.17
- mn10300 76, removed in 4.17
- nds32 163, removed in 5.18
- nios2 163
- openrisc 163
- parisc 76
- score 163, removed in 4.17
- sh 76
- sparc 144
- sparc64 144
- tilegx 163, removed in 4.17
- tilepro 163, removed in 4.17
- xtensa 189
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/getrlimit