sched_getattr on x64
set and get scheduling policy and attributes
sys_sched_getattr(pid_t pid, struct sched_attr *attr, unsigned int size, unsigned int flags)
| number | 315 (0x13b) |
|---|---|
| abi | common |
| entry point | sys_sched_getattr |
| since | Linux 3.14 |
| man page | sched_getattr(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 315, the syscall number |
rdi | pid_t pid |
rsi | struct sched_attr *attr |
rdx | unsigned int size |
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 352
- arm64 275
- arm 381
- riscv64 275
- ia32 352
- x32 1073742139
- loongarch64 275
- ppc64 356
- ppc 356
- s390x 346
- mips64 5310
- mipsn32 6314
- mipso32 4350
- alpha 509
- arc 275
- blackfin 386, removed in 4.17
- cris 353, removed in 4.17
- csky 275
- hexagon 275
- ia64 1337, removed in 6.7
- m68k 350
- metag 275, removed in 4.17
- microblaze 382
- nds32 275, removed in 5.18
- nios2 275
- openrisc 275
- parisc 335
- score 275, removed in 4.17
- sh 369
- sparc 344
- sparc64 344
- tilegx 275, removed in 4.17
- tilepro 275, removed in 4.17
- xtensa 335
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/sched_getattr