tee-system-call · shipping · also tee(2)

tee (Linux system call)

The Linux tee system call duplicates up to a given number of bytes from one pipe into another without consuming the data in the source pipe.

Both descriptors must refer to pipes, and to different pipes, otherwise the call fails with EINVAL. Duplicated data stays in the input pipe, so a later splice(2) can move it elsewhere. A return of 0 means no data is available and no writers remain on the input pipe. SPLICE_F_MOVE and SPLICE_F_MORE currently have no effect, and SPLICE_F_NONBLOCK yields EAGAIN instead of blocking. [1]

Duplication retains references rather than creating independent payload snapshots, because the kernel grabs a reference to the input buffers instead of copying bytes. This is distinct from the user-facing tee command and from trusted execution environments abbreviated TEE. [1]

The amount that can be duplicated is bounded by what the input pipe holds. Default pipe capacity is 16 pages, or 65,536 bytes with 4096-byte pages, and F_SETPIPE_SZ can change it. [3]

Relations

related
splice, sendfile, Zero-copy I/O, Checksum

Advantages

  • One pipe stream can feed two consumers without a round trip through userspace memory. [1]

Limitations

  • The interface is Linux-specific, available since Linux 2.6.17 and glibc 2.5, and is not part of POSIX. [1]
  • Since Linux 4.5 the default pipe capacity can fall below 16 pages when a per-user soft limit is exceeded. [3]

Citations

  1. Linux man-pages 6.19: tee(2), duplication without consuming and shared references (accessed 2026-10-23)
  2. Linux man-pages 6.19: pipe(7), pipe capacity (accessed 2026-10-23)

Further reading

  1. Hesela: Two consumers can disagree after tee(2) (accessed 2026-10-18)
Sources & caveats
  • tee is the Linux man-pages 6.19 tee(2) page, re-read for descriptor rules, flags, return values, history and the reference-sharing note.
  • pipe7 is the Linux man-pages 6.19 pipe(7) page, read for default pipe capacity and per-user limits.
  • A sequential source-mutation experiment with ten observations found that two consumers of duplicated file-backed data can observe different versions, while a buffered-input control kept matching bytes.
  • The zero-copy entry links here because tee duplicates pipe buffers by reference rather than copying payload bytes.

JSON: /data/terms/tee-system-call.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. tee (Linux system call). Hesela. 2026-10-23. https://hesela.dev/terms/tee-system-call/