[PATCH] Use sendfile to copy data between file descriptors

Laurent Bercot ska-dietlibc at skarnet.org
Mon Oct 20 12:34:02 UTC 2014


Le 20/10/2014 13:36, Bartosz Golaszewski a écrit :
> Busybox already uses sendfile in httpd. This patch proposes to use it
> globally to copy data between file descriptors.

  I haven't been keeping up-to-date with sendfile() in the last couple of
years, but AFAICR sendfile() was limited in the type of file it's writing
from/to, and the way to perform zero-copy data transmission across generic
fds is splice().

  Which is not generic either, because splice() needs a pipe as one of its
endpoints, so if you're copying from a socket to a file, for instance, you
need a pipe in the middle, and splice from the socket to the pipe then splice
from the pipe to the file.

  This is a bit complex to handle for every case. I have done it in skalibs,
so the code is there, and I can busyboxify it if needed, but that's quite a
bit of code and additional complexity for a gain that would only be felt on
large data copies, so I'm not sure it's worth it.

-- 
  Laurent



More information about the busybox mailing list