]>
Commit | Line | Data |
---|---|---|
2bc4bb77 MK |
1 | .\" Hey Emacs! This file is -*- nroff -*- source. |
2 | .\" | |
3 | .\" This manpage is Copyright (C) 2006 Jens Axboe | |
4 | .\" and Copyright (C) 2006 Michael Kerrisk <mtk-manpages@gmx.net> | |
5 | .\" | |
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. | |
9 | .\" | |
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. | |
14 | .\" | |
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 | |
21 | .\" professionally. | |
22 | .\" | |
23 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
24 | .\" the source, must acknowledge the copyright and authors of this work. | |
25 | .\" | |
26 | .TH vmsplice 2 2006-04-28 "Linux 2.6.17" "Linux Programmer's Manual" | |
27 | .SH NAME | |
28 | vmsplice \- splice user pages into a pipe | |
29 | .SH SYNOPSIS | |
30 | .nf | |
31 | .B #define _GNU_SOURCE | |
32 | .B #include <fcntl.h> | |
33 | .B #include <sys/uio.h> | |
34 | ||
35 | .BI "long vmsplice(int " fd ", const struct iovec *" iov , | |
36 | .BI " unsigned long " nr_segs ", unsigned int " flags ); | |
37 | .fi | |
38 | .SH DESCRIPTION | |
39 | .\" Linus: vmsplice() system call to basically do a "write to | |
40 | .\" the buffer", but using the reference counting and VM traversal | |
41 | .\" to actually fill the buffer. This means that the user needs to | |
42 | .\" be careful not to re-use the user-space buffer it spliced into | |
43 | .\" the kernel-space one (contrast this to "write()", which copies | |
44 | .\" the actual data, and you can thus re-use the buffer immediately | |
45 | .\" after a successful write), but that is often easy to do. | |
46 | The | |
47 | .BR vmsplice () | |
48 | system call maps | |
49 | .I nr_segs | |
50 | ranges of user memory described by | |
51 | .I iov | |
52 | into a pipe. | |
53 | The file descriptor | |
54 | .I fd | |
55 | must refer to a pipe. | |
56 | ||
57 | The pointer | |
58 | .I iov | |
59 | points to an array of | |
60 | .I iovec | |
61 | structures as defined in | |
62 | .IR <sys/uio.h> : | |
63 | ||
64 | .in +0.25i | |
65 | .nf | |
66 | struct iovec { | |
67 | void *iov_base; /* Starting address */ | |
68 | size_t iov_len; /* Number of bytes */ | |
69 | }; | |
70 | .in -0.25i | |
71 | .fi | |
72 | ||
73 | The | |
74 | .I flags | |
75 | argument is a bit mask that is composed by ORing together | |
76 | zero or more of the following values: | |
77 | .TP 1.9i | |
78 | .B SPLICE_F_MOVE | |
79 | Unused for | |
80 | .BR vmsplice (); | |
81 | see | |
82 | .BR splice (2). | |
83 | .TP | |
84 | .B SPLICE_F_NONBLOCK | |
85 | .\" Not used for vmsplice | |
86 | .\" May be in the future -- therefore EAGAIN | |
87 | Do not block on I/O; see | |
88 | .BR splice (2) | |
89 | for further details. | |
90 | .TP | |
91 | .B SPLICE_F_MORE | |
92 | Currently has no effect for | |
93 | .BR vmsplice (), | |
94 | but may be implemented in the future; see | |
95 | .BR splice (2). | |
96 | .TP | |
97 | .B SPLICE_F_GIFT | |
98 | The user pages are a gift to the kernel. | |
99 | The application may not modify this memory ever, | |
100 | .\" FIXME Explain the following line in a little more detail: | |
101 | or page cache and on-disk data may differ. | |
102 | Gifting pages to the kernel means that a subsequent | |
103 | .BR splice () | |
104 | .B SPLICE_F_MOVE | |
105 | can successfully move the pages; | |
106 | if this flag is not specified, then a subsequent | |
107 | .BR splice () | |
108 | .B SPLICE_F_MOVE | |
109 | must copy the pages. | |
110 | Data must also be properly page aligned, both in memory and length. | |
111 | .\" .... if we expect to later SPLICE_F_MOVE to the cache. | |
112 | .SH RETURN VALUE | |
113 | Upon successful completion, | |
114 | .BR vmsplice () | |
115 | returns the number of bytes transferred to the pipe. | |
116 | On error, | |
117 | .BR vmplice () | |
118 | returns \-1 and | |
119 | .I errno | |
120 | is set to indicate the error. | |
121 | .SH ERRORS | |
122 | .TP | |
123 | .B EBADF | |
124 | .I fd | |
125 | either not valid, or doesn't refer to a pipe. | |
126 | .TP | |
127 | .B EINVAL | |
128 | .I nr_segs | |
129 | is 0 or greater than | |
130 | .BR IOV_MAX; | |
131 | or memory not aligned if | |
132 | .B SPLICE_F_GIFT | |
133 | set. | |
134 | .TP | |
135 | .B ENOMEM | |
136 | Out of memory. | |
137 | .SH NOTES | |
138 | .BR vmsplice () | |
139 | follows the other vectorized read/write type functions when it comes to | |
140 | limitations on number of segments being passed in. | |
141 | This limit is | |
142 | .B IOV_MAX | |
143 | as defined in | |
144 | .IR <limits.h> . | |
145 | At the time of this writing, that limit is 1024. | |
146 | .SH HISTORY | |
147 | The | |
148 | .BR vmsplice (2) | |
149 | system call first appeared in Linux-2.6.17. | |
150 | .SH "CONFORMING TO" | |
151 | This system call is Linux specific. | |
152 | .SH SEE ALSO | |
153 | .BR splice (2), | |
0a90178c MK |
154 | .BR tee (2), |
155 | .BR feature_test_macros (7) |