1VMSPLICE(2) Linux Programmer's Manual VMSPLICE(2)
2
3
4
6 vmsplice - splice user pages into a pipe
7
9 #define _GNU_SOURCE /* See feature_test_macros(7) */
10 #include <fcntl.h>
11 #include <sys/uio.h>
12
13 ssize_t vmsplice(int fd, const struct iovec *iov,
14 unsigned long nr_segs, unsigned int flags);
15
17 The vmsplice() system call maps nr_segs ranges of user memory described
18 by iov into a pipe. The file descriptor fd must refer to a pipe.
19
20 The pointer iov points to an array of iovec structures as defined in
21 <sys/uio.h>:
22
23 struct iovec {
24 void *iov_base; /* Starting address */
25 size_t iov_len; /* Number of bytes */
26 };
27
28 The flags argument is a bit mask that is composed by ORing together
29 zero or more of the following values:
30
31 SPLICE_F_MOVE Unused for vmsplice(); see splice(2).
32
33 SPLICE_F_NONBLOCK Do not block on I/O; see splice(2) for further
34 details.
35
36 SPLICE_F_MORE Currently has no effect for vmsplice(), but may be
37 implemented in the future; see splice(2).
38
39 SPLICE_F_GIFT The user pages are a gift to the kernel. The appli‐
40 cation may not modify this memory ever, or page
41 cache and on-disk data may differ. Gifting pages to
42 the kernel means that a subsequent splice(2)
43 SPLICE_F_MOVE can successfully move the pages; if
44 this flag is not specified, then a subsequent
45 splice(2) SPLICE_F_MOVE must copy the pages. Data
46 must also be properly page aligned, both in memory
47 and length.
48
50 Upon successful completion, vmsplice() returns the number of bytes
51 transferred to the pipe. On error, vmsplice() returns -1 and errno is
52 set to indicate the error.
53
55 EBADF fd either not valid, or doesn't refer to a pipe.
56
57 EINVAL nr_segs is 0 or greater than IOV_MAX; or memory not aligned if
58 SPLICE_F_GIFT set.
59
60 ENOMEM Out of memory.
61
63 The vmsplice() system call first appeared in Linux 2.6.17; library sup‐
64 port was added to glibc in version 2.5.
65
67 This system call is Linux-specific.
68
70 vmsplice() follows the other vectorized read/write type functions when
71 it comes to limitations on number of segments being passed in. This
72 limit is IOV_MAX as defined in <limits.h>. At the time of this writ‐
73 ing, that limit is 1024.
74
76 splice(2), tee(2)
77
79 This page is part of release 3.53 of the Linux man-pages project. A
80 description of the project, and information about reporting bugs, can
81 be found at http://www.kernel.org/doc/man-pages/.
82
83
84
85Linux 2012-05-04 VMSPLICE(2)