.\" This manpage is Copyright (C) 2006 Jens Axboe .\" and Copyright (C) 2006 Michael Kerrisk .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2007 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2007-02-04, Akihiro MOTOKI .\" .TH VMSPLICE 2 2019\-03\-06 Linux "Linux Programmer's Manual" .SH 名前 vmsplice \- ユーザーページをパイプに継ぎ合わせる .SH 書式 .nf \fB#define _GNU_SOURCE\fP /* feature_test_macros(7) 参照 */ \fB#include \fP \fB#include \fP .PP \fBssize_t vmsplice(int \fP\fIfd\fP\fB, const struct iovec *\fP\fIiov\fP\fB,\fP \fB unsigned long \fP\fInr_segs\fP\fB, unsigned int \fP\fIflags\fP\fB);\fP .fi .\" Return type was long before glibc 2.7 .SH 説明 .\" Linus: vmsplice() system call to basically do a "write to .\" the buffer", but using the reference counting and VM traversal .\" to actually fill the buffer. This means that the user needs to .\" be careful not to reuse the user-space buffer it spliced into .\" the kernel-space one (contrast this to "write()", which copies .\" the actual data, and you can thus reuse the buffer immediately .\" after a successful write), but that is often easy to do. .\" Since Linux 2.6.23 .\" commit 6a14b90bb6bc7cd83e2a444bf457a2ea645cbfe7 If \fIfd\fP is opened for writing, the \fBvmsplice\fP() system call maps \fInr_segs\fP ranges of user memory described by \fIiov\fP into a pipe. If \fIfd\fP is opened for reading, the \fBvmsplice\fP() system call fills \fInr_segs\fP ranges of user memory described by \fIiov\fP from a pipe. The file descriptor \fIfd\fP must refer to a pipe. .PP ポインター \fIiov\fP は \fIiovec\fP 構造体の配列を指す。 \fIiovec\fP 構造体は \fI\fP で以下のように定義されている: .PP .in +4n .EX struct iovec { void *iov_base; /* 開始アドレス */ size_t iov_len; /* バイト数 */ }; .EE .in .PP \fIflags\fP 引数には、以下の値の 0 個以上をビット毎の論理和の形で指定する。 .TP \fBSPLICE_F_MOVE\fP \fBvmsplice\fP() では未使用。 \fBsplice\fP(2) 参照。 .TP \fBSPLICE_F_NONBLOCK\fP .\" Not used for vmsplice .\" May be in the future -- therefore EAGAIN 入出力で停止 (block) しない。詳細は \fBsplice\fP(2) 参照。 .TP \fBSPLICE_F_MORE\fP 現在のところ \fBvmsplice\fP() では何の効果もないが、将来的には実装される可能性がある。 \fBsplice\fP(2) 参照。 .TP \fBSPLICE_F_GIFT\fP .\" FIXME . Explain the following line in a little more detail: .\" FIXME .\" It looks like the page-alignment requirement went away with .\" commit bd1a68b59c8e3bce45fb76632c64e1e063c3962d .\" .\" .... if we expect to later SPLICE_F_MOVE to the cache. ユーザーページがカーネルへ渡すもの (gift) であることを示す。 アプリケーションはこのメモリーを絶対に変更してはならない。 さもなければ、ページキャッシュとディスク上のデータは 一致しなくなるだろう。 ページをカーネルに渡すと、この次の \fBsplice\fP(2) \fBSPLICE_F_MOVE\fP でそのページの移動を行うことができる。 このフラグが指定されなかった場合、この次の \fBsplice\fP(2) \fBSPLICE_F_MOVE\fP でそのページのコピーを行わなければならない。 データはメモリー上でページ境界にあっていなければならず、 長さもページ境界の倍数でなければならない。 .SH 返り値 成功して完了すると、 \fBvmsplice\fP() はパイプに転送したバイト数を返す。 エラーの場合、 \fBvmplice\fP() は \-1 を返し、 \fIerrno\fP をエラーを示す値に設定する。 .SH エラー .TP \fBEAGAIN\fP \fBSPLICE_F_NONBLOCK\fP が \fIflags\fP に指定されていて、かつ操作が停止するような状態であった。 .TP \fBEBADF\fP \fIfd\fP が有効でない、もしくはパイプを参照していない。 .TP \fBEINVAL\fP \fInr_segs\fP が \fBIOV_MAX\fP よりも大きい。または \fBSPLICE_F_GIFT\fP が設定されたがメモリーがページ境界にあっていない。 .TP \fBENOMEM\fP メモリー不足。 .SH バージョン \fBvmsplice\fP() システムコールは Linux 2.6.17 で初めて登場した。 ライブラリによるサポートは glibc バージョン 2.5 で追加された。 .SH 準拠 このシステムコールは Linux 固有である。 .SH 注意 .\" UIO_MAXIOV in kernel source 指定されたセグメント数が上限に達した場合、 \fBvmsplice\fP() は他のベクトル形式の read/write を行う関数と同じ動作をする。 上限は \fBIOV_MAX\fP であり、 \fI\fP で定義されている。現時点では、この値は 1024 である。 .PP .\" commit 6a14b90bb6bc7cd83e2a444bf457a2ea645cbfe7 \fBvmsplice\fP() really supports true splicing only from user memory to a pipe. In the opposite direction, it actually just copies the data to userspace. But this makes the interface nice and symmetric and enables people to build on \fBvmsplice\fP() with room for future improvement in performance. .SH 関連項目 \fBsplice\fP(2), \fBtee\fP(2), \fBpipe\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。