mq_getsetattr on x64
get/set message queue attributes
sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr *mqstat, struct mq_attr *omqstat)
| number | 245 (0xf5) |
|---|---|
| abi | common |
| kconfig | CONFIG_POSIX_MQUEUE |
| family | mqueue see the whole family on x64 |
| entry point | sys_mq_getsetattr |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | mq_getsetattr(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 245, the syscall number |
rdi | mqd_t mqdes |
rsi | const struct mq_attr *mqstat |
rdx | struct mq_attr *omqstat |
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 282
- arm64 185
- arm 279
- riscv64 185
- ia32 282
- x32 1073742069
- loongarch64 185
- ppc64 267
- ppc 267
- s390x 276
- mips64 5235
- mipsn32 6239
- mipso32 4276
- alpha 437
- arc 185
- blackfin 283, removed in 4.17
- cris 282, removed in 4.17
- csky 185
- frv 282, removed in 4.17
- hexagon 185
- ia64 1267, removed in 6.7
- m32r 282, removed in 4.17
- m68k 276
- metag 185, removed in 4.17
- microblaze 282
- mn10300 282, removed in 4.17
- nds32 185, removed in 5.18
- nios2 185
- openrisc 185
- parisc 234
- score 185, removed in 4.17
- sh 282
- sparc 278
- sparc64 278
- tilegx 185, removed in 4.17
- tilepro 185, removed in 4.17
- xtensa 237
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/mq_getsetattr