splice(2) System Calls Manual splice(2) splice - / LIBRARY Standard C library (libc, -lc) #define _GNU_SOURCE /* See feature_test_macros(7) */ #define _FILE_OFFSET_BITS 64 #include ssize_t splice(int fd_in, off_t *_Nullable off_in, int fd_out, off_t *_Nullable off_out, size_t len, unsigned int flags); splice() . len fd_in fd_out, . fd_in off_in : o fd_in , off_in NULL. o fd_in off_in NULL, fd_in . o fd_in off_in NULL, off_in , fd_in; fd_in . fd_out off_out. flags , (OR) : SPLICE_F_MOVE , . : , , . : Linux 2.6.21 ( splice()); , . SPLICE_F_NONBLOCK -. , splice(), , , , , ( O_NONBLOCK). SPLICE_F_MORE . , fd_out ( MSG_MORE send(2) TCP_CORK tcp(7)). SPLICE_F_GIFT splice(); vmsplice(2). splice() , . 0 . fd_in , , , , . splice() -1, errno . EAGAIN flags SPLICE_F_NONBLOCK (O_NONBLOCK), . EBADF -. EINVAL (splicing). EINVAL . EINVAL . EINVAL (, ). EINVAL fd_in fd_out . ENOMEM . ESPIPE off_in off_out NULL, . Linux. Linux 2.6.17, glibc 2.5. Linux 2.6.30 , fd_in fd_out . Linux 2.6.31 . -- splice(), vmsplice(2), and tee(2), ; , . : splice() , . tee(2) <<>> . vmsplice(2) <<>> . , , , . . <<>> ( ), , : , . _FILE_OFFSET_BITS should be defined to be 64 in code that uses non-null off_in or off_out or that takes the address of splice, if the code is intended to be portable to traditional 32-bit x86 and ARM platforms where off_t's width defaults to 32 bits. . tee(2). . copy_file_range(2), sendfile(2), tee(2), vmsplice(2), pipe(7) Alexander Golubev , Azamat Hackimov , Hotellook, Nikita , Spiros Georgaras , Vladislav , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . splice(2)