[PATCH] Use sendfile to copy data between file descriptors

Baruch Siach baruch at tkos.co.il
Mon Oct 20 12:45:50 UTC 2014


Hi Laurent,

On Mon, Oct 20, 2014 at 02:34:02PM +0200, Laurent Bercot wrote:
> 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().

This has changed in kernel version 2.6.33. Since that version sendfile() 
out_fd can be any file. The in_fd parameter must support mmap, though. See the 
sendfile(2) man page.

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -


More information about the busybox mailing list