setrlimit on x64
get/set resource limits
sys_setrlimit(unsigned int resource, struct rlimit *rlim)
| number | 160 (0xa0) |
|---|---|
| abi | common |
| entry point | sys_setrlimit |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | setrlimit(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 160, 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 75
- arm64 164
- arm 75
- riscv64 164
- ia32 75
- x32 1073741984
- ppc64 75
- ppc 75
- s390x 75
- mips64 5155
- mipsn32 6155
- mipso32 4075
- alpha 145
- arc 164
- blackfin 75, removed in 4.17
- cris 75, removed in 4.17
- csky 164
- frv 75, removed in 4.17
- hexagon 164
- ia64 1084, removed in 6.7
- m32r 75, removed in 4.17
- m68k 75
- metag 164, removed in 4.17
- microblaze 75
- mn10300 75, removed in 4.17
- nds32 164, removed in 5.18
- nios2 164
- openrisc 164
- parisc 75
- score 164, removed in 4.17
- sh 75
- sparc 145
- sparc64 145
- tilegx 164, removed in 4.17
- tilepro 164, removed in 4.17
- xtensa 188
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/setrlimit