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
32 Unused for vmsplice(); see splice(2).
33
34 SPLICE_F_NONBLOCK
35 Do not block on I/O; see splice(2) for further details.
36
37 SPLICE_F_MORE
38 Currently has no effect for vmsplice(), but may be implemented
39 in the future; see splice(2).
40
41 SPLICE_F_GIFT
42 The user pages are a gift to the kernel. The application may
43 not modify this memory ever, otherwise the page cache and on-
44 disk data may differ. Gifting pages to the kernel means that a
45 subsequent splice(2) SPLICE_F_MOVE can successfully move the
46 pages; if this flag is not specified, then a subsequent
47 splice(2) SPLICE_F_MOVE must copy the pages. Data must also be
48 properly page aligned, both in memory and length.
49
51 Upon successful completion, vmsplice() returns the number of bytes
52 transferred to the pipe. On error, vmsplice() returns -1 and errno is
53 set to indicate the error.
54
56 EAGAIN SPLICE_F_NONBLOCK was specified in flags, and the operation
57 would block.
58
59 EBADF fd either not valid, or doesn't refer to a pipe.
60
61 EINVAL nr_segs is greater than IOV_MAX; or memory not aligned if
62 SPLICE_F_GIFT set.
63
64 ENOMEM Out of memory.
65
67 The vmsplice() system call first appeared in Linux 2.6.17; library sup‐
68 port was added to glibc in version 2.5.
69
71 This system call is Linux-specific.
72
74 vmsplice() follows the other vectorized read/write type functions when
75 it comes to limitations on the number of segments being passed in.
76 This limit is IOV_MAX as defined in <limits.h>. Currently, this limit
77 is 1024.
78
80 splice(2), tee(2), pipe(7)
81
83 This page is part of release 4.15 of the Linux man-pages project. A
84 description of the project, information about reporting bugs, and the
85 latest version of this page, can be found at
86 https://www.kernel.org/doc/man-pages/.
87
88
89
90Linux 2017-09-15 VMSPLICE(2)