1vmsplice(2) Linux Programmer's Manual vmsplice(2)
2
3
4
6 vmsplice - splice user pages into a pipe
7
9 #define _GNU_SOURCE
10 #include <fcntl.h>
11 #include <sys/uio.h>
12
13 long 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()
43 SPLICE_F_MOVE can successfully move the pages; if
44 this flag is not specified, then a subsequent
45 splice() 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, vmplice() 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 vmsplice() follows the other vectorized read/write type functions when
64 it comes to limitations on number of segments being passed in. This
65 limit is IOV_MAX as defined in <limits.h>. At the time of this writ‐
66 ing, that limit is 1024.
67
69 The vmsplice(2) system call first appeared in Linux-2.6.17.
70
72 This system call is Linux specific.
73
75 splice(2), tee(2), feature_test_macros(7)
76
77
78
79Linux 2.6.17 2006-04-28 vmsplice(2)