3 ms·
This may go against the grain but this isn't really worth abstracting over since it's not portable. You'll probably want to implement it by hand everywhere you
by duped 3y ago
This may go against the grain but this isn't really worth abstracting over since it's not portable. You'll probably want to implement it by hand everywhere you need it.
Higher level code only uses them rarely because they're pretty special purpose and they have to be specialized for Linux. If you're shuffling data around without looking at it only on Linux, splice is useful. There's not that many applications that have that property (something like say, TCP/UDP proxies definitely need it - but your bog standard HTTP server? Not so much).
And if you are writing these apps then the buzzwords like "zero copy" come up often, and splice is one of the first results you'll see.
- NavinF 3y agoThe main reason why people write abstractions over stuff like this is to make it portable. I'm sure there's something similar to vmsplice on every relevant OS. The library can also fallback to write_read if you're targeting some ancient platform
- duped 3y ago> I'm sure there's something similar to vmsplice on every relevant OS. There isn't.
- gpderetta 3y agoI think Linus generally considers splice a failed experiment. It works fine is some simple scenarios, but the generalized support for it needed to make it work failed to materialize. Having said that, these days sendfile is implemented in term of splice, so in a way many HTTP servers use it.