.\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" This manpage is Copyright (C) 2006 Jens Axboe .\" and Copyright (C) 2006 Michael Kerrisk .\" .\" 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. .\" .\" Japanese Version Copyright (c) 2007 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2007-02-04, Akihiro MOTOKI .\" .TH VMSPLICE 2 2009-09-15 "Linux" "Linux Programmer's Manual" .SH 名前 vmsplice \- ユーザ・ページをパイプに継ぎ合わせる .SH 書式 .nf .B #define _GNU_SOURCE .B #include .B #include .BI "ssize_t vmsplice(int " fd ", const struct iovec *" iov , .BI " unsigned long " nr_segs ", unsigned int " flags ); .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. .BR vmsplice () システムコールは、 .I iov で指定されたユーザ・メモリの .I nr_segs の範囲をパイプにマッピングする。 .I fd はパイプを参照していなければならない。 ポインタ .I iov は .I iovec 構造体の配列を指す。 .I iovec 構造体は .I で以下のように定義されている: .in +4n .nf struct iovec { void *iov_base; /* 開始アドレス */ size_t iov_len; /* バイト数 */ }; .in .fi .I flags 引き数には、以下の値の 0 個以上をビット毎の論理和の形で指定する。 .TP 1.9i .B SPLICE_F_MOVE .BR vmsplice () では未使用。 .BR splice (2) 参照。 .TP .B SPLICE_F_NONBLOCK .\" Not used for vmsplice .\" May be in the future -- therefore EAGAIN 入出力で停止 (block) しない。詳細は .BR splice (2) 参照。 .TP .B SPLICE_F_MORE 現在のところ .BR vmsplice () では何の効果もないが、将来的には実装される可能性がある。 .BR splice (2) 参照。 .TP .B SPLICE_F_GIFT ユーザ・ページがカーネルへ渡すもの (gift) であることを示す。 アプリケーションはこのメモリを絶対に変更してはならない。 .\" FIXME Explain the following line in a little more detail: さもなければ、ページキャッシュとディスク上のデータは 一致しなくなるだろう。 ページをカーネルに渡すと、この次の .BR splice (2) .B SPLICE_F_MOVE でそのページの移動を行うことができる。 このフラグが指定されなかった場合、この次の .BR splice (2) .B SPLICE_F_MOVE でそのページのコピーを行わなければならない。 データはメモリ上でページ境界にあっていなければならず、 長さもページ境界の倍数でなければならない。 .\" .... if we expect to later SPLICE_F_MOVE to the cache. .SH 返り値 成功して完了すると、 .BR vmsplice () はパイプに転送したバイト数を返す。 エラーの場合、 .BR vmplice () は \-1 を返し、 .I errno をエラーを示す値に設定する。 .SH エラー .TP .B EBADF .I fd が有効でない、もしくはパイプを参照していない。 .TP .B EINVAL .I nr_segs が 0 もしくは .B IOV_MAX よりも大きい。または .B SPLICE_F_GIFT が設定されたがメモリがページ境界にあっていない。 .TP .B ENOMEM メモリ不足。 .SH バージョン .BR vmsplice () システムコールは Linux 2.6.17 で初めて登場した。 .SH 準拠 このシステムコールは Linux 固有である。 .SH 備考 指定されたセグメント数が上限に達した場合、 .BR vmsplice () は他のベクトル形式の read/write を行う関数と同じ動作をする。 上限は .B IOV_MAX であり、 .I で定義されている。 このドキュメントを書いた時点での値は 1024 である。 .SH 関連項目 .BR splice (2), .BR tee (2), .BR feature_test_macros (7)