应用程序可以使用 io_uring 系统调用或任何其他系统调用在执行零复制时将数据从套接字传输到文件吗?

can io_uring system call or any other system call be used by an application to transfer data from a socket to file while doing a zero copy?

是否有任何系统调用可以将数据从套接字复制到文件?我查看了 sendfile 系统调用,发现 input_fd 必须是一个文件描述符,所以我想知道在从套接字接收数据并存储数据时,应用程序是否可以利用任何系统调用来进行零复制在文件中?

(这看起来像 Understanding sendfile() and splice() 的副本)这里的提问者想知道从套接字读取的数据是否可以 zero-copied 到文件并提到 io_uring强烈建议提问者对 Linux.

特别感兴趣

简而言之,可以从套接字接收数据并输出到文件,而不必使用 splice(2) on Linux but it's not trivial - the socket must be attached to one end of the pipe and the file's descriptor to the other end. Since the 5.7 Linux kernel io_uring also supports a splice operation 制作不必要的重复副本,因此它也可以通过以下方式从套接字到文件进行零复制一根烟斗。