tee on x64
duplicating pipe content
sys_tee(int fdin, int fdout, size_t len, unsigned int flags)
| number | 276 (0x114) |
|---|---|
| abi | common |
| entry point | sys_tee |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | tee(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 276, the syscall number |
rdi | int fdin |
rsi | int fdout |
rdx | size_t len |
r10 | unsigned int flags |
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 315
- arm64 77
- arm 342
- riscv64 77
- ia32 315
- x32 1073742100
- loongarch64 77
- ppc64 284
- ppc 284
- s390x 308
- mips64 5265
- mipsn32 6269
- mipso32 4306
- alpha 470
- arc 77
- blackfin 344, removed in 4.17
- cris 315, removed in 4.17
- csky 77
- frv 315, removed in 4.17
- hexagon 77
- ia64 1301, removed in 6.7
- m32r 315, removed in 4.17
- m68k 308
- metag 77, removed in 4.17
- microblaze 315
- mn10300 316, removed in 4.17
- nds32 77, removed in 5.18
- nios2 77
- openrisc 77
- parisc 293
- score 77, removed in 4.17
- sh 315
- sparc 280
- sparc64 280
- tilegx 77, removed in 4.17
- tilepro 77, removed in 4.17
- xtensa 269
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/tee