.TH splice 2 2006-04-28 "Linux 2.6.17" "Linux Programmer's Manual" .SH NAME splice \- splice data to/from a pipe. .SH SYNOPSIS .B #include .B long splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t bytes, unsigned int flags); .SH DESCRIPTION The act of splicing can be seen as a way to connect two ends of a rope through a kernel buffer, where that buffer is implemented as a pipe. It provides a means to move data around without copying it to/from kernel/user address space. The .BR splice () function splices .I bytes of data between file descriptor .I fd_in and .IR fd_out , where one of the descriptors must refer to a pipe. The .I flags argument is a series of modifier flags: .TP 1.9i .B SPLICE_F_MOVE Attempt to move pages instead of copying. .TP .B SPLICE_F_NONBLOCK Do not block on io. .TP .B SPLICE_F_MORE More data will be coming in a subsequent splice. This is a helpful hint when the output descriptor refers to a socket, see also .B MSG_MORE (see .BR send (2) and .B TCP_CORK .BR tcp (7)) .TP .B SPLICE_F_GIFT See .BR vmsplice (2). .SH RETURN VALUE Upon successful completion, .BR splice () shall return the number of bytes spliced to or from the pipe. Otherwise, it shall return a value of -1 and .I errno shall be set to indicate an error. .SH ERRORS .TP 1.1i .B EBADF .I fd either not valid, or none of the descriptors refer to a pipe. .TP .B EINVAL Target file system doesn't support splicing, none of the descriptors refer to a pipe or offset given for non-seekable device. .SH SEE ALSO .BR splice (2), .BR tee (2) .SH AUTHORS Jens Axboe