1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" This manpage is Copyright (C) 2006 Jens Axboe
4 .\" and Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
26 .TH VMSPLICE 2 2009-09-15 "Linux" "Linux Programmer's Manual"
28 vmsplice \- splice user pages into a pipe
31 .B #define _GNU_SOURCE
33 .B #include <sys/uio.h>
35 .BI "ssize_t vmsplice(int " fd ", const struct iovec *" iov ,
36 .BI " unsigned long " nr_segs ", unsigned int " flags );
38 .\" Return type was long before glibc 2.7
40 .\" Linus: vmsplice() system call to basically do a "write to
41 .\" the buffer", but using the reference counting and VM traversal
42 .\" to actually fill the buffer. This means that the user needs to
43 .\" be careful not to re-use the user-space buffer it spliced into
44 .\" the kernel-space one (contrast this to "write()", which copies
45 .\" the actual data, and you can thus re-use the buffer immediately
46 .\" after a successful write), but that is often easy to do.
51 ranges of user memory described by
62 structures as defined in
68 void *iov_base; /* Starting address */
69 size_t iov_len; /* Number of bytes */
76 argument is a bit mask that is composed by ORing together
77 zero or more of the following values:
86 .\" Not used for vmsplice
87 .\" May be in the future -- therefore EAGAIN
88 Do not block on I/O; see
93 Currently has no effect for
95 but may be implemented in the future; see
99 The user pages are a gift to the kernel.
100 The application may not modify this memory ever,
101 .\" FIXME Explain the following line in a little more detail:
102 or page cache and on-disk data may differ.
103 Gifting pages to the kernel means that a subsequent
106 can successfully move the pages;
107 if this flag is not specified, then a subsequent
111 Data must also be properly page aligned, both in memory and length.
112 .\" .... if we expect to later SPLICE_F_MOVE to the cache.
114 Upon successful completion,
116 returns the number of bytes transferred to the pipe.
121 is set to indicate the error.
126 either not valid, or doesn't refer to a pipe.
132 or memory not aligned if
141 system call first appeared in Linux 2.6.17.
143 This system call is Linux-specific.
146 follows the other vectorized read/write type functions when it comes to
147 limitations on number of segments being passed in.
152 At the time of this writing, that limit is 1024.
156 .BR feature_test_macros (7)