shmctl on x64
System V shared memory control
sys_shmctl(int shmid, int cmd, struct shmid_ds *buf)
| number | 31 (0x1f) |
|---|---|
| abi | common |
| kconfig | CONFIG_SYSVIPC |
| family | sysvipc see the whole family on x64 |
| entry point | sys_shmctl |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | shmctl(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 31, the syscall number |
rdi | int shmid |
rsi | int cmd |
rdx | struct shmid_ds *buf |
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 396
- arm64 195
- arm 308
- riscv64 195
- ia32 396
- x32 1073741855
- loongarch64 195
- ppc64 396
- ppc 396
- s390x 396
- mips64 5030
- mipsn32 6030
- mipso32 4396
- alpha 210
- arc 195
- blackfin 339, removed in 4.17
- csky 195
- hexagon 195
- ia64 1116, removed in 6.7
- m68k 396
- metag 195, removed in 4.17
- microblaze 336
- nds32 195, removed in 5.18
- nios2 195
- openrisc 195
- parisc 195
- score 195, removed in 4.17
- sh 396
- sparc 396
- sparc64 396
- tilegx 195, removed in 4.17
- tilepro 195, removed in 4.17
- xtensa 94
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/shmctl