-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
.\" This manpage is Copyright (C) 2006 Jens Axboe
.\" and Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
.\"
+.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
-.TH SPLICE 2 2009-09-15 "Linux" "Linux Programmer's Manual"
+.TH SPLICE 2 2014-12-31 "Linux" "Linux Programmer's Manual"
.SH NAME
splice \- splice data to/from a pipe
.SH SYNOPSIS
.nf
-.B #define _GNU_SOURCE
+.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <fcntl.h>
.BI "ssize_t splice(int " fd_in ", loff_t *" off_in ", int " fd_out ,
.IR fd_out ,
where one of the descriptors must refer to a pipe.
+The following semantics apply for
+.I fd_in
+and
+.IR off_in :
+.IP * 3
If
.I fd_in
refers to a pipe, then
.I off_in
must be NULL.
+.IP *
If
.I fd_in
does not refer to a pipe and
.I fd_in
starting from the current file offset,
and the current file offset is adjusted appropriately.
+.IP *
If
.I fd_in
does not refer to a pipe and
in this case, the current file offset of
.I fd_in
is not changed.
+.PP
Analogous statements apply for
.I fd_out
and
is set to indicate the error.
.SH ERRORS
.TP
+.B EAGAIN
+.B SPLICE_F_NONBLOCK
+was specified in
+.IR flags ,
+and the operation would block.
+.TP
.B EBADF
One or both file descriptors are not valid,
or do not have proper read-write mode.
.TP
.B EINVAL
-Target file system doesn't support splicing;
+Target filesystem doesn't support splicing;
target file is opened in append mode;
.\" The append-mode error is given since 2.6.27; in earlier kernels,
.\" splice() in append mode was broken
.SH VERSIONS
The
.BR splice ()
-system call first appeared in Linux 2.6.17.
-.SH "CONFORMING TO"
+system call first appeared in Linux 2.6.17;
+library support was added to glibc in version 2.5.
+.SH CONFORMING TO
This system call is Linux-specific.
.SH NOTES
The three system calls
.BR vmsplice (2),
and
.BR tee (2),
-provide userspace programs with full control over an arbitrary
+provide user-space programs with full control over an arbitrary
kernel buffer, implemented within the kernel using the same type
of buffer that is used for a pipe.
In overview, these system calls perform the following tasks:
.SH SEE ALSO
.BR sendfile (2),
.BR tee (2),
-.BR vmsplice (2),
-.BR feature_test_macros (7)
+.BR vmsplice (2)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.