semctl on x64
System V semaphore control operations
sys_semctl(int semid, int semnum, int cmd, unsigned long arg)
| number | 66 (0x42) |
|---|---|
| abi | common |
| kconfig | CONFIG_SYSVIPC |
| family | sysvipc see the whole family on x64 |
| entry point | sys_semctl |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | semctl(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 66, the syscall number |
rdi | int semid |
rsi | int semnum |
rdx | int cmd |
r10 | unsigned long arg |
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 394
- arm64 191
- arm 300
- riscv64 191
- ia32 394
- x32 1073741890
- loongarch64 191
- ppc64 394
- ppc 394
- s390x 394
- mips64 5064
- mipsn32 6064
- mipso32 4394
- alpha 204
- arc 191
- blackfin 331, removed in 4.17
- csky 191
- hexagon 191
- ia64 1108, removed in 6.7
- m68k 394
- metag 191, removed in 4.17
- microblaze 328
- nds32 191, removed in 5.18
- nios2 191
- openrisc 191
- parisc 187
- score 191, removed in 4.17
- sh 394
- sparc 394
- sparc64 394
- tilegx 191, removed in 4.17
- tilepro 191, removed in 4.17
- xtensa 164
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/semctl