1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright 2003 Abhijit Menon-Sen <ams@wiw.org>
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" 2005-04-08 mtk, noted kernel version and added BUGS
26 .\" Japanese Version Copyright (c) 2004-2007 Yuichi SATO
27 .\" all rights reserved.
28 .\" Translated Sun Jun 20 16:23:17 JST 2004
29 .\" by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v1.66
30 .\" Updated & Modified Fri Apr 22 03:05:51 JST 2005 by Yuichi SATO, LDP v2.02
31 .\" Updated & Modified Thu Jan 4 23:55:18 JST 2007 by Yuichi SATO, LDP v2.43
33 .TH POSIX_FADVISE 2 2003-02-14 "Linux" "Linux Programmer's Manual"
36 .\"O posix_fadvise \- predeclare an access pattern for file data
37 posix_fadvise \- ファイルデータのアクセスパターンをあらかじめ宣言する
41 .B #define _XOPEN_SOURCE 600
44 .BI "int posix_fadvise(int " fd ", off_t " offset ", off_t " len \
50 .\"O .BR posix_fadvise ()
51 .\"O to announce an intention to access
52 .\"O file data in a specific pattern in the future, thus allowing the kernel
53 .\"O to perform appropriate optimizations.
54 プログラムは、将来特定のパターンでファイルデータに
58 これにより、カーネルが適切な最適化を実行することが可能になる。
60 .\"O The \fIadvice\fP applies to a (not necessarily existent) region starting
61 .\"O at \fIoffset\fP and extending for \fIlen\fP bytes (or until the end of
62 .\"O the file if \fIlen\fP is 0) within the file referred to by \fIfd\fP.
63 .\"O The advice is not binding; it merely constitutes an expectation on behalf of
65 \fIadvice\fP は \fIfd\fP が参照しているファイルの
66 \fIoffset\fP から始まる \fIlen\fP バイトの範囲内
67 (\fIlen\fP が 0 の場合はファイルの終りまで) の
70 アドバイスは単にアプリケーションのために可能性を構成するだけである。
72 .\"O Permissible values for \fIadvice\fP include:
73 \fIadvice\fP に許される値には、以下のものが含まれる:
76 .\"O Indicates that the application has no advice to give about its access
77 .\"O pattern for the specified data.
78 .\"O If no advice is given for an open file,
79 .\"O this is the default assumption.
80 指定されたデータのアクセスパターンを指示するアドバイスを
81 アプリケーションが何も持っていないことを示す。
82 オープンされたファイルにアドバイスが指定されない場合、
85 .B POSIX_FADV_SEQUENTIAL
86 .\"O The application expects to access the specified data sequentially (with
87 .\"O lower offsets read before higher ones).
88 アプリケーションは指定されたデータがシーケンシャルに
89 (大きなオフセットの前に小さなオフセットのデータを読むように)
93 .\"O The specified data will be accessed in random order.
94 指定されたデータがランダムな順番でアクセスされる。
97 .\"O The specified data will be accessed only once.
98 指定されたデータは 1 度しかアクセスされない。
100 .B POSIX_FADV_WILLNEED
101 .\"O The specified data will be accessed in the near future.
102 指定されたデータは近い将来アクセスされる。
104 .B POSIX_FADV_DONTNEED
105 .\"O The specified data will not be accessed in the near future.
106 指定されたデータは近い将来アクセスされない。
107 .\"O .SH "RETURN VALUE"
109 .\"O On success, zero is returned.
110 .\"O On error, an error number is returned.
117 .\"O The \fIfd\fP argument was not a valid file descriptor.
118 \fIfd\fP 引き数が有効なファイルディスクリプタでない。
121 .\"O An invalid value was specified for \fIadvice\fP.
122 無効な値が \fIadvice\fP に指定された。
125 .\"O returns EINVAL in this case.)
126 .\"O The specified file descriptor refers to a pipe or FIFO.
131 指定されたファイルディスクリプタがパイプまたは FIFO を参照している
137 .\"O .BR posix_fadvise ()
138 .\"O appeared in kernel 2.5.60.
139 .\"O .\" Actually as fadvise64() -- MTK
140 .\"O Glibc support has been provided since version 2.2.
143 .\" 実際には fadvise64() として登場した。-- MTK
144 glibc でのサポートは glibc バージョン 2.2 以降で行われている。
145 .\"O .SH "CONFORMING TO"
148 .\"O Note that the type of the
150 .\"O argument was changed from
154 .\"O in POSIX.1-2003 TC1.
156 引き数の型が POSIX.1-2003 TC1 において
162 .\"O Under Linux, \fBPOSIX_FADV_NORMAL\fP sets the readahead window to the
163 .\"O default size for the backing device; \fBPOSIX_FADV_SEQUENTIAL\fP doubles
164 .\"O this size, and \fBPOSIX_FADV_RANDOM\fP disables file readahead entirely.
166 Linux では、\fBPOSIX_FADV_NORMAL\fP はバッキングデバイスの
167 デフォルトサイズに先読み (readahead) ウインドウを設定する。
168 \fBPOSIX_FADV_SEQUENTIAL\fP はこのサイズを 2 倍し、
169 \fBPOSIX_FADV_RANDOM\fP は先読みを全く無効にする。
170 .\"O These changes affect the entire file, not just the specified region
171 .\"O (but other open file handles to the same file are unaffected).
172 これらの変更はファイル全体に影響し、指定された領域のみに影響するわけではない
173 (しかし同じファイルに対する他のオープンファイルハンドルは影響を受けない)。
175 .\"O \fBPOSIX_FADV_WILLNEED\fP initiates a
176 .\"O nonblocking read of the specified region into the page cache.
177 .\"O The amount of data read may be decreased by the kernel depending
178 .\"O on virtual memory load.
179 .\"O (A few megabytes will usually be fully satisfied,
180 .\"O and more is rarely useful.)
181 \fBPOSIX_FADV_WILLNEED\fP は、
182 ページキャッシュに指定領域のブロックされない読み込みを開始する。
184 仮想メモリの負荷に依ってカーネルが減らすかもしれない
185 (数メガバイトであれば通常は全く十分であり、
188 .\"O In kernels before 2.6.18, \fBPOSIX_FADV_NOREUSE\fP had the
189 .\"O same semantics as \fBPOSIX_FADV_WILLNEED\fP.
190 .\"O This was probably a bug; since kernel 2.6.18, this flag is a no-op.
191 2.6.18 より前のカーネルでは、\fBPOSIX_FADV_NOREUSE\fP は
192 \fBPOSIX_FADV_WILLNEED\fP と同じ意味であった。
194 カーネル 2.6.18 以降では、このフラグは何も行わない。
196 .\"O \fBPOSIX_FADV_DONTNEED\fP attempts to free cached pages associated with
197 .\"O the specified region.
198 .\"O This is useful, for example, while streaming large
200 .\"O A program may periodically request the kernel to free cached data
201 .\"O that has already been used, so that more useful cached pages are not
202 .\"O discarded instead.
203 \fBPOSIX_FADV_DONTNEED\fP は指定された領域に関連付けられた
205 例えば、これは大きなファイルをストリーミングするときに役立つ。
206 プログラムは、使用済みのキャッシュされたデータを解放するように、
208 そうすることにより、さらに有効なキャッシュされたページが、
211 .\"O Pages that have not yet been written out will be unaffected, so if the
212 .\"O application wishes to guarantee that pages will be released, it should
216 .\"O .BR fdatasync (2)
218 まだ書き出されていないページは影響を受けないので、
219 そのページの解放が保証されることをアプリケーションが望んでいるなら、
227 .\"O In kernels before 2.6.6, if
229 .\"O was specified as 0, then this was interpreted literally as "zero bytes",
230 .\"O rather than as meaning "all bytes through to the end of the file".
234 「ファイルの終りまでの全てのバイト」という意味ではなく、
235 文字通り「0 バイト」として解釈されていた。
239 .BR posix_fallocate (3),
240 .BR posix_madvise (3)
241 .\" FIXME . Write a posix_fadvise(3) page.