1 .\" This manpage is Copyright (C) 2006 Jens Axboe
2 .\" and Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .TH VMSPLICE 2 (date) "Linux man-pages (unreleased)"
8 vmsplice \- splice user pages to/from a pipe
11 .RI ( libc ", " \-lc )
14 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
17 .BI "ssize_t vmsplice(int " fd ", const struct iovec *" iov ,
18 .BI " size_t " nr_segs ", unsigned int " flags );
20 .\" Return type was long before glibc 2.7
22 .\" Linus: vmsplice() system call to basically do a "write to
23 .\" the buffer", but using the reference counting and VM traversal
24 .\" to actually fill the buffer. This means that the user needs to
25 .\" be careful not to reuse the user-space buffer it spliced into
26 .\" the kernel-space one (contrast this to "write()", which copies
27 .\" the actual data, and you can thus reuse the buffer immediately
28 .\" after a successful write), but that is often easy to do.
31 is opened for writing, the
35 ranges of user memory described by
40 is opened for reading,
41 .\" Since Linux 2.6.23
42 .\" commit 6a14b90bb6bc7cd83e2a444bf457a2ea645cbfe7
47 ranges of user memory described by
58 structures as described in
63 argument is a bit mask that is composed by ORing together
64 zero or more of the following values:
73 .\" Not used for vmsplice
74 .\" May be in the future -- therefore EAGAIN
75 Do not block on I/O; see
80 Currently has no effect for
82 but may be implemented in the future; see
86 The user pages are a gift to the kernel.
87 The application may not modify this memory ever,
88 .\" FIXME . Explain the following line in a little more detail:
89 otherwise the page cache and on-disk data may differ.
90 Gifting pages to the kernel means that a subsequent
93 can successfully move the pages;
94 if this flag is not specified, then a subsequent
98 Data must also be properly page aligned, both in memory and length.
100 .\" It looks like the page-alignment requirement went away with
101 .\" commit bd1a68b59c8e3bce45fb76632c64e1e063c3962d
103 .\" .... if we expect to later SPLICE_F_MOVE to the cache.
105 Upon successful completion,
107 returns the number of bytes transferred to the pipe.
112 is set to indicate the error.
119 and the operation would block.
123 either not valid, or doesn't refer to a pipe.
129 or memory not aligned if
138 system call first appeared in Linux 2.6.17;
139 library support was added to glibc in version 2.5.
141 This system call is Linux-specific.
144 follows the other vectorized read/write type functions when it comes to
145 limitations on the number of segments being passed in.
151 .\" UIO_MAXIOV in kernel source
154 .\" commit 6a14b90bb6bc7cd83e2a444bf457a2ea645cbfe7
156 really supports true splicing only from user memory to a pipe.
157 In the opposite direction, it actually just copies the data to user space.
158 But this makes the interface nice and symmetric and enables people to build on
160 with room for future improvement in performance.