title: Using `splice` for Linux... what else for other systems?
body: <p>On recent Linux kernels, afaict, the fastest way of copying a file or a subset of a file to another file is through the use of the very nice <code>splice</code> system call. This system gets the kernel to manage the transfer (almost) directly, without ever having to copy the data to userland memory.</p>
  
  <p>Now, I would be interested in finding something similar for other systems, in particular Windows and BSD/MacOS X (I am willing to get some code written in Obj-C in the unlikely case there is an API that cannot be accessed from raw C).</p>
  
  <p>Thanks</p>
  
  <p><strong>Note</strong> I assume that the fastest full-file copy under Windows is <code>CopyFile</code>. But what about copying only a range of a file?</p>
  
  <p><strong>Note</strong>  I am working on code that is both performance-sensitive and should work on a variety of mass storage devices (i.e. from Android smartphones to NFS mounts). I am, of course, willing to write different implementations for different OSes.</p>
  
  <p><strong>Note</strong> At the moment, I use <code>splice</code> under Linux/Android, <code>copyfile</code> under BSD/Mac OS X, <code>CopyFile</code> under Windows, and fallback to <code>read</code>/<code>write</code> for ranges in files.</p>