Conill: How efficient can cat(1) be?

Post Syndicated from original https://lwn.net/Articles/901707/

Ariadne Conill explores
ways to make the Unix cat utility more efficient on
Linux.

The first possible option is the venerable sendfile syscall, which
was originally added to improve the file serving performance of web
servers. Originally, sendfile required the destination file
descriptor to be a socket, but this restriction was removed in
Linux 2.6.33. Unfortunately, sendfile is not perfect: because it
only supports file descriptors which can be memory mapped, we must
use a different strategy when using copying from stdin.