2 ms·
That depends on what you're doing. Sendfile, splice and copy_file_range are the fastest if you want to shovel things back and forth between file descriptors. Th
by the8472 8y ago
That depends on what you're doing. Sendfile, splice and copy_file_range are the fastest if you want to shovel things back and forth between file descriptors. The latter supports reflink copy if the the underlying filesystem does.
And I think there's some special casing in vmsplice that lets you transfer memory pages from process to process over a pipe. At least I've seen some patches for that, not sure if they made it into the kernel. Alternatively there's memfd.
But if you want to coordinate processes you'll use a shared memory and futexes.
If you just want to hand over an entire file to a different process you can send the file descriptor itself over a unix socket.
- ArtWomb 8y ago>>> you can send the file descriptor itself over a unix socket Oh, that is genius ;) Described in detail here, from Stevens Unix Network Programming http://www.masterraghu.com/subjects/np/introduction/unix_network_programming_v1.3/ch15lev1sec7.html http://www.masterraghu.com/subjects/np/introduction/unix_net...