setpgid on x64
set/get process group
sys_setpgid(pid_t pid, pid_t pgid)
| number | 109 (0x6d) |
|---|---|
| abi | common |
| entry point | sys_setpgid |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | setpgid(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 109, the syscall number |
rdi | pid_t pid |
rsi | pid_t pgid |
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 57
- arm64 154
- arm 57
- riscv64 154
- ia32 57
- x32 1073741933
- loongarch64 154
- ppc64 57
- ppc 57
- s390x 57
- mips64 5107
- mipsn32 6107
- mipso32 4057
- alpha 39
- arc 154
- blackfin 57, removed in 4.17
- cris 57, removed in 4.17
- csky 154
- frv 57, removed in 4.17
- hexagon 154
- ia64 1080, removed in 6.7
- m32r 57, removed in 4.17
- m68k 57
- metag 154, removed in 4.17
- microblaze 57
- mn10300 57, removed in 4.17
- nds32 154, removed in 5.18
- nios2 154
- openrisc 154
- parisc 57
- score 154, removed in 4.17
- sh 57
- sparc 185
- sparc64 185
- tilegx 154, removed in 4.17
- tilepro 154, removed in 4.17
- xtensa 148
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/setpgid