]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/vmsplice.2
grfix
[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
c11b1abf 4.\" and Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
2bc4bb77
MK
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.
c13182ef 14.\"
2bc4bb77
MK
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.
c13182ef 22.\"
2bc4bb77
MK
23.\" Formatted or processed versions of this manual, if unaccompanied by
24.\" the source, must acknowledge the copyright and authors of this work.
25.\"
d9343c5c 26.TH VMSPLICE 2 2006-04-28 "Linux" "Linux Programmer's Manual"
2bc4bb77
MK
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
c13182ef 35.BI "long vmsplice(int " fd ", const struct iovec *" iov ,
2bc4bb77
MK
36.BI " unsigned long " nr_segs ", unsigned int " flags );
37.fi
38.SH DESCRIPTION
c13182ef
MK
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.
2bc4bb77
MK
46The
47.BR vmsplice ()
48system call maps
49.I nr_segs
50ranges of user memory described by
51.I iov
c13182ef 52into a pipe.
2bc4bb77 53The file descriptor
c13182ef 54.I fd
2bc4bb77
MK
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
a08ea57c 64.in +4n
2bc4bb77
MK
65.nf
66struct iovec {
67 void *iov_base; /* Starting address */
68 size_t iov_len; /* Number of bytes */
69};
a08ea57c 70.in
2bc4bb77
MK
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
c13182ef
MK
87Do not block on I/O; see
88.BR splice (2)
2bc4bb77
MK
89for further details.
90.TP
91.B SPLICE_F_MORE
c13182ef 92Currently has no effect for
2bc4bb77
MK
93.BR vmsplice (),
94but may be implemented in the future; see
95.BR splice (2).
96.TP
97.B SPLICE_F_GIFT
c13182ef
MK
98The user pages are a gift to the kernel.
99The application may not modify this memory ever,
2bc4bb77 100.\" FIXME Explain the following line in a little more detail:
c13182ef 101or page cache and on-disk data may differ.
2bc4bb77 102Gifting pages to the kernel means that a subsequent
0bfa087b 103.BR splice (2)
2bc4bb77
MK
104.B SPLICE_F_MOVE
105can successfully move the pages;
106if this flag is not specified, then a subsequent
0bfa087b 107.BR splice (2)
2bc4bb77
MK
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 ()
c13182ef
MK
115returns the number of bytes transferred to the pipe.
116On error,
d504a994 117.BR vmsplice ()
2bc4bb77
MK
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
4df883b9 130.BR IOV_MAX ;
2bc4bb77
MK
131or memory not aligned if
132.B SPLICE_F_GIFT
133set.
134.TP
135.B ENOMEM
136Out of memory.
2dd578fd
MK
137.SH VERSIONS
138The
2777b1ca 139.BR vmsplice ()
ceaeac24 140system call first appeared in Linux 2.6.17.
2dd578fd
MK
141.SH "CONFORMING TO"
142This system call is Linux specific.
2bc4bb77
MK
143.SH NOTES
144.BR vmsplice ()
145follows the other vectorized read/write type functions when it comes to
c13182ef 146limitations on number of segments being passed in.
2bc4bb77
MK
147This limit is
148.B IOV_MAX
149as defined in
150.IR <limits.h> .
151At the time of this writing, that limit is 1024.
2bc4bb77
MK
152.SH SEE ALSO
153.BR splice (2),
0a90178c
MK
154.BR tee (2),
155.BR feature_test_macros (7)