Merge branch 'master' of ssh://axboe@router.home.kernel.dk/data/git/splice
[splice.git] / vmsplice.2
CommitLineData
f758e908
JA
1.TH vmsplice 2 2006-04-28 "Linux 2.6.17" "Linux Programmer's Manual"
2.SH NAME
3vmsplice \- splice user pages into a pipe
4.SH SYNOPSIS
5.B #include <sys/uio.h>
6
7.B long vmsplice(int fd, const struct iovec *iov, unsigned long nr_segs, unsigned ing flags);
8
9.SH DESCRIPTION
10The \fIvmsplice\fR() function maps \fInr_segs\fR range(s) of \fIiov\fR described user memory into a pipe. The \fIfd\fR must refer to a pipe.
11
12The pointer \fIiov\fR points to an array of \fIstruct iovec\fR entries as
13defined in \fI<sys/uio.h>\fR:
14
15.nf
16 struct iovec {
17 void *iov_base; /* Starting address */
18 size_t iov_len; /* Number of bytes */
19 };
20.fi
21
22The \fIflags\fR argument is a series of modifier flags. Only
23.B SPLICE_F_NONBLOCK
24and
25.B SPLICE_F_GIFT
26really apply to \fIvmsplice\fR(), the but the scope is shared with
27\fBsplice\fR().
28
29.TP 1.9i
30.B SPLICE_F_MOVE
31Attempt to move pages instead of copying.
32.TP
33.B SPLICE_F_NONBLOCK
34Do not block on io.
35.TP
36.B SPLICE_F_MORE
37More data will be coming in a subsequent splice.
38.TP
39.B SPLICE_F_GIFT
40The user pages are a gift to the kernel. The application may not reuse this
41memory ever, or page cache and on disk data may differ. Data must also be
42properly page aligned.
43
44.SH RETURN VALUE
45Upon successful completion, \fIvmsplice\fR() shall return the number of bytes
46spliced to the pipe. Otherwise, it shall return a value of -1 and \fIerrno\fR
47shall be set to indicate an error.
48
49.SH ERRORS
50.B EBADF \fIfd\fR either not valid, or doesn't refer to a pipe.
51.TP 7
52.B EINVAL \fInr_segs\fR not valid, memory not aligned if \fISPLICE_F_GIFT\fR
53set.
54
55.SH NOTES
56\fIvmsplice\fR() follows the other vectorized read/write type functions when
57it comes to limitations on number of segments being passed in. This limit
58is \fBIOV_MAX\fR as defined in \fI<limits.h>\fR. At the time of this writing,
59that limit is 1024.
60
61.SH AUTHORS
62Jens Axboe <axboe@suse.de>