[PATCH] vmsplice: allow for setting of SPLICE_F_GIFT flag.
[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
8d2541ed
JA
10The
11.BR vmsplice ()
12function maps
13.I nr_segs
14range(s) of
15.I iov
16described user memory into a pipe. The
17.I fd must refer to a pipe.
f758e908 18
8d2541ed
JA
19The pointer
20.I iov
21points to an array of
22.I struct iovec
23entries as defined in
24.IR <sys/uio.h> :
f758e908
JA
25
26.nf
27 struct iovec {
28 void *iov_base; /* Starting address */
29 size_t iov_len; /* Number of bytes */
30 };
31.fi
32
8d2541ed
JA
33The
34.I flags
35argument is a series of modifier flags. Only
f758e908
JA
36.B SPLICE_F_NONBLOCK
37and
38.B SPLICE_F_GIFT
8d2541ed
JA
39really apply to
40.BR vmsplice ()
41, the but the scope is shared with
42.BR splice ().
f758e908
JA
43
44.TP 1.9i
45.B SPLICE_F_MOVE
46Attempt to move pages instead of copying.
47.TP
48.B SPLICE_F_NONBLOCK
49Do not block on io.
50.TP
51.B SPLICE_F_MORE
52More data will be coming in a subsequent splice.
53.TP
54.B SPLICE_F_GIFT
55The user pages are a gift to the kernel. The application may not reuse this
56memory ever, or page cache and on disk data may differ. Data must also be
8d2541ed 57properly page aligned, both in memory and length.
f758e908
JA
58
59.SH RETURN VALUE
8d2541ed
JA
60Upon successful completion,
61.BR vmsplice ()
62shall return the number of bytes spliced to the pipe. Otherwise, it shall
63return a value of -1 and
64.I errno
f758e908
JA
65shall be set to indicate an error.
66
67.SH ERRORS
8d2541ed
JA
68.TP 1.1i
69.B EBADF
70.I fd
71either not valid, or doesn't refer to a pipe.
72.TP
73.B EINVAL
74.I nr_segs
75not valid, memory not aligned if
76.I SPLICE_F_GIFT
f758e908
JA
77set.
78
79.SH NOTES
8d2541ed
JA
80.BR vmsplice ()
81follows the other vectorized read/write type functions when it comes to
82limitations on number of segments being passed in. This limit is
83.B IOV_MAX
84as defined in
85.IR <limits.h> .
86At the time of this writing, that limit is 1024.
87
88.SH SEE ALSO
89.BR splice (2),
90.BR tee (2)
f758e908
JA
91
92.SH AUTHORS
93Jens Axboe <axboe@suse.de>