Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The use case for splice is moving data from one file descriptor to another without reading it, for example port forwarding/mirroring (or taking over sendfile, dumping a file to a socket or socket to file). It doesn't cover IPC where you have messages that are actually being sent from one process to another and presumably, you want to read and write those bytes.


>(or taking over sendfile, dumping a file to a socket or socket to file)

splice only works if one of the two fds is a pipe. It cannot replace sendfile.


That was the original implementation. I believe this has since been relaxed. I think the kernel will allocate a pipe internally in some cases. The man pages are known to be incomplete.

In fact I think sendfile is implemented with the splice machinery now.


You can do it with two calls to splice




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: