sched_setscheduler on x64
set and get scheduling policy/parameters
sys_sched_setscheduler(pid_t pid, int policy, struct sched_param *param)
| number | 144 (0x90) |
|---|---|
| abi | common |
| entry point | sys_sched_setscheduler |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | sched_setscheduler(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 144, the syscall number |
rdi | pid_t pid |
rsi | int policy |
rdx | struct sched_param *param |
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 156
- arm64 119
- arm 156
- riscv64 119
- ia32 156
- x32 1073741968
- loongarch64 119
- ppc64 156
- ppc 156
- s390x 156
- mips64 5141
- mipsn32 6141
- mipso32 4160
- alpha 332
- arc 119
- blackfin 156, removed in 4.17
- cris 156, removed in 4.17
- csky 119
- frv 156, removed in 4.17
- hexagon 119
- ia64 1163, removed in 6.7
- m32r 156, removed in 4.17
- m68k 156
- metag 119, removed in 4.17
- microblaze 156
- mn10300 156, removed in 4.17
- nds32 119, removed in 5.18
- nios2 119
- openrisc 119
- parisc 156
- score 119, removed in 4.17
- sh 156
- sparc 243
- sparc64 243
- tilegx 119, removed in 4.17
- tilepro 119, removed in 4.17
- xtensa 214
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/sched_setscheduler