.\" This manpage is Copyright (C) 2004, 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 .\" .\" 2004-05-40 Created by Michael Kerrisk .\" 2004-10-05 aeb, minor correction .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2005 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2005-02-26, Akihiro MOTOKI .\" Updated 2013-05-06, Akihiro MOTOKI .\" .TH READAHEAD 2 2014\-03\-15 Linux "Linux Programmer's Manual" .SH 名前 readahead \- 前もってファイルをページキャッシュに読み込む .SH 書式 .nf \fB#define _GNU_SOURCE\fP /* feature_test_macros(7) 参照 */ \fB#include \fP .sp \fBssize_t readahead(int \fP\fIfd\fP\fB, off64_t \fP\fIoffset\fP\fB, size_t \fP\fIcount\fP\fB);\fP .fi .SH 説明 \fBreadahead\fP() はファイルの先読みを行い、そのファイルに対する後の読み込みがキャッシュから行われ、ディスク I/O で停止しないようにする (この条件を満たせるのは、先読みは十分早く行われ、システムの他の動作によりその後にキャッシュからページがフラッシュされない場合である)。 \fIfd\fP 引き数は読み込みを行うファイルを識別するファイルディスクリプターである。 \fIoffset\fP 引き数はデータの読み込み開始位置を指定し、 \fIcount\fP は読み込むデータのバイト数を指定する。 ディスク I/O はページ単位で実行されるので、 実際には \fIoffset\fP はページ境界に切り下げられ、読み込みバイト数は \fI(offset+count)\fP より小さくない次のページ境界まで切り上げられる。 \fBreadahead\fP() はファイルの末尾を越えた範囲まで読み出しを行うことはない。 \fIfd\fP で参照されたオープン済のファイルのファイルオフセットの現在値は 変更されない。 .SH 返り値 \fBreadahead\fP() は成功すると 0 を返す。失敗した場合 \-1 を返し、 \fIerrno\fP にエラーの原因を示す値を設定する。 .SH エラー .TP \fBEBADF\fP \fIfd\fP が有効なファイルディスクリプターでない、または 読み込み用にオープンされていない。 .TP \fBEINVAL\fP \fIfd\fP が参照しているファイルが、 \fBreadahead\fP() を行うことができないタイプのファイルであった。 .SH バージョン \fBreadahead\fP() システムコールは Linux 2.4.13 で登場した。 glibc でのサポートは glibc バージョン 2.3 以降で行われている。 .SH 準拠 \fBreadahead\fP() システムコールは Linux 固有であり、移植を考慮したプログラムでは 使用を避けるべきである。 .SH 注意 いくつかの 32 ビットアーキテクチャーでは、このシステムコールの呼び出しシグネチャーが違っている。 理由は \fBsyscall\fP(2) で説明されている。 .SH バグ \fBreadahead\fP() は読み込みをバックグラウンドで行うようにスケジューリングを行い、すぐに返る。 しかしながら、要求されたブロックの位置を知るために必要なファイルシステムのメタデータを読み込む間は \fBreadahead\fP() は停止することがある。 これは ext[234] で大きなファイルをエクステントではなく間接ブロックを使う場合にしばしば発生し、 要求したデータが読み込まれるまで呼び出しが停止しているように見える。 .SH 関連項目 \fBlseek\fP(2), \fBmadvise\fP(2), \fBmmap\fP(2), \fBposix_fadvise\fP(2), \fBread\fP(2) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。