]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/vmsplice.2
sync
[thirdparty/man-pages.git] / man2 / vmsplice.2
CommitLineData
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
28vmsplice \- 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.
46The
47.BR vmsplice ()
48system call maps
49.I nr_segs
50ranges of user memory described by
51.I iov
52into a pipe.
53The file descriptor
54.I fd
55must refer to a pipe.
56
57The pointer
58.I iov
59points to an array of
60.I iovec
61structures as defined in
62.IR <sys/uio.h> :
63
64.in +0.25i
65.nf
66struct iovec {
67 void *iov_base; /* Starting address */
68 size_t iov_len; /* Number of bytes */
69};
70.in -0.25i
71.fi
72
73The
74.I flags
75argument is a bit mask that is composed by ORing together
76zero or more of the following values:
77.TP 1.9i
78.B SPLICE_F_MOVE
79Unused for
80.BR vmsplice ();
81see
82.BR splice (2).
83.TP
84.B SPLICE_F_NONBLOCK
85.\" Not used for vmsplice
86.\" May be in the future -- therefore EAGAIN
87Do not block on I/O; see
88.BR splice (2)
89for further details.
90.TP
91.B SPLICE_F_MORE
92Currently has no effect for
93.BR vmsplice (),
94but may be implemented in the future; see
95.BR splice (2).
96.TP
97.B SPLICE_F_GIFT
98The user pages are a gift to the kernel.
99The application may not modify this memory ever,
100.\" FIXME Explain the following line in a little more detail:
101or page cache and on-disk data may differ.
102Gifting pages to the kernel means that a subsequent
103.BR splice ()
104.B SPLICE_F_MOVE
105can successfully move the pages;
106if this flag is not specified, then a subsequent
107.BR splice ()
108.B SPLICE_F_MOVE
109must copy the pages.
110Data 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
113Upon successful completion,
114.BR vmsplice ()
115returns the number of bytes transferred to the pipe.
116On error,
117.BR vmplice ()
118returns \-1 and
119.I errno
120is set to indicate the error.
121.SH ERRORS
122.TP
123.B EBADF
124.I fd
125either not valid, or doesn't refer to a pipe.
126.TP
127.B EINVAL
128.I nr_segs
129is 0 or greater than
130.BR IOV_MAX;
131or memory not aligned if
132.B SPLICE_F_GIFT
133set.
134.TP
135.B ENOMEM
136Out of memory.
137.SH NOTES
138.BR vmsplice ()
139follows the other vectorized read/write type functions when it comes to
140limitations on number of segments being passed in.
141This limit is
142.B IOV_MAX
143as defined in
144.IR <limits.h> .
145At the time of this writing, that limit is 1024.
146.SH HISTORY
147The
148.BR vmsplice (2)
149system call first appeared in Linux-2.6.17.
150.SH "CONFORMING TO"
151This 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)