1 .\" This manpage is Copyright (C) 2006 Jens Axboe
2 .\" and Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
26 .TH VMSPLICE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
28 vmsplice \- splice user pages to/from a pipe
31 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
34 .BI "ssize_t vmsplice(int " fd ", const struct iovec *" iov ,
35 .BI " size_t " nr_segs ", unsigned int " flags );
37 .\" Return type was long before glibc 2.7
39 .\" Linus: vmsplice() system call to basically do a "write to
40 .\" the buffer", but using the reference counting and VM traversal
41 .\" to actually fill the buffer. This means that the user needs to
42 .\" be careful not to reuse the user-space buffer it spliced into
43 .\" the kernel-space one (contrast this to "write()", which copies
44 .\" the actual data, and you can thus reuse the buffer immediately
45 .\" after a successful write), but that is often easy to do.
48 is opened for writing, the
52 ranges of user memory described by
57 is opened for reading,
58 .\" Since Linux 2.6.23
59 .\" commit 6a14b90bb6bc7cd83e2a444bf457a2ea645cbfe7
64 ranges of user memory described by
75 structures as defined in
81 void *iov_base; /* Starting address */
82 size_t iov_len; /* Number of bytes */
89 argument is a bit mask that is composed by ORing together
90 zero or more of the following values:
99 .\" Not used for vmsplice
100 .\" May be in the future -- therefore EAGAIN
101 Do not block on I/O; see
106 Currently has no effect for
108 but may be implemented in the future; see
112 The user pages are a gift to the kernel.
113 The application may not modify this memory ever,
114 .\" FIXME . Explain the following line in a little more detail:
115 otherwise the page cache and on-disk data may differ.
116 Gifting pages to the kernel means that a subsequent
119 can successfully move the pages;
120 if this flag is not specified, then a subsequent
124 Data must also be properly page aligned, both in memory and length.
126 .\" It looks like the page-alignment requirement went away with
127 .\" commit bd1a68b59c8e3bce45fb76632c64e1e063c3962d
129 .\" .... if we expect to later SPLICE_F_MOVE to the cache.
131 Upon successful completion,
133 returns the number of bytes transferred to the pipe.
138 is set to indicate the error.
145 and the operation would block.
149 either not valid, or doesn't refer to a pipe.
155 or memory not aligned if
164 system call first appeared in Linux 2.6.17;
165 library support was added to glibc in version 2.5.
167 This system call is Linux-specific.
170 follows the other vectorized read/write type functions when it comes to
171 limitations on the number of segments being passed in.
177 .\" UIO_MAXIOV in kernel source
180 .\" commit 6a14b90bb6bc7cd83e2a444bf457a2ea645cbfe7
182 really supports true splicing only from user memory to a pipe.
183 In the opposite direction, it actually just copies the data to user space.
184 But this makes the interface nice and symmetric and enables people to build on
186 with room for future improvement in performance.