fgetxattr on x64
retrieve an extended attribute value
sys_fgetxattr(int fd, const char *name, void *value, size_t size)
| number | 193 (0xc1) |
|---|---|
| abi | common |
| entry point | sys_fgetxattr |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | fgetxattr(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 193, the syscall number |
rdi | int fd |
rsi | const char *name |
rdx | void *value |
r10 | size_t size |
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 231
- arm64 10
- arm 231
- riscv64 10
- ia32 231
- x32 1073742017
- loongarch64 10
- ppc64 214
- ppc 214
- s390x 229
- mips64 5185
- mipsn32 6185
- mipso32 4229
- alpha 387
- arc 10
- blackfin 231, removed in 4.17
- cris 231, removed in 4.17
- csky 10
- frv 231, removed in 4.17
- hexagon 10
- ia64 1222, removed in 6.7
- m32r 231, removed in 4.17
- m68k 228
- metag 10, removed in 4.17
- microblaze 231
- mn10300 231, removed in 4.17
- nds32 10, removed in 5.18
- nios2 10
- openrisc 10
- parisc 243
- score 10, removed in 4.17
- sh 231
- sparc 177
- sparc64 177
- tilegx 10, removed in 4.17
- tilepro 10, removed in 4.17
- xtensa 77
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/fgetxattr