.\" 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. .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH POSIX_FALLOCATE 3 2010\-09\-20 GNU "Linux Programmer's Manual" .SH 名前 posix_fallocate \- ファイルのスペースを確保する .SH 書式 .nf \fB#include \fP .sp \fBint posix_fallocate(int \fP\fIfd\fP\fB, off_t \fP\fIoffset\fP\fB, off_t \fP\fIlen\fP\fB);\fP .fi .sp .ad l .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp \fBposix_fallocate\fP(): .RS 4 _XOPEN_SOURCE\ >=\ 600 || _POSIX_C_SOURCE\ >=\ 200112L .RE .ad .SH 説明 関数 \fBposix_fallocate\fP() は、ディスクリプタ \fIfd\fP で参照されるファイルに対して、ディスクスペースを確実に確保する。 ディスクスペースは \fIoffset\fP から始まる \fIlen\fP バイトの範囲のバイトである。 \fBposix_fallocate\fP() の呼び出しが成功した後、指定された範囲のバイトに対する書き込みは、 ディスクスペースの不足で失敗しないことが保証される。 ファイルのサイズが \fIoffset\fP+\fIlen\fP より小さい場合、ファイルはこのサイズになるように拡大される。 それ以外の場合、ファイルサイズは変わらない。 .SH 返り値 \fBposix_fallocate\fP() は成功した場合、0 を返す。 失敗した場合、エラー番号を返す。 \fIerrno\fP が設定されない点に注意すること。 .SH エラー .TP \fBEBADF\fP \fIfd\fP が有効なファイルディスクリプタでないか、 書き込み用としてオープンされていない。 .TP \fBEFBIG\fP \fIoffset+len\fP が最大ファイルサイズを超えている。 .TP \fBEINVAL\fP \fIoffset\fP が 0 未満だったか、 \fIlen\fP が 0 以下だった。 .TP \fBENODEV\fP \fIfd\fP が通常のファイルとして参照されていない。 .TP \fBENOSPC\fP \fIfd\fP が参照するファイルを含むデバイスに十分な空き領域がない。 .TP \fBESPIPE\fP \fIfd\fP がパイプを参照している。 .SH バージョン \fBposix_fallocate\fP() は glibc 2.1.94 以降で利用可能である。 .SH 準拠 POSIX.1\-2001. POSIX.1\-2008 では、 \fIlen\fP が 0 の場合、もしくは \fIoffset\fP が 0 未満の場合、 \fBEINVAL\fP エラーを返すものとされている。 POSIX.1\-2001 では、 \fIlen\fP が 0 未満の場合、もしくは \fIoffset\fP が 0 未満の場合、 \fBEINVAL\fP エラーを返すものとされている。また、 \fIlen\fP が 0 の場合、 \fBEINVAL\fP エラーを返してもよいとされている。 .SH 関連項目 \fBfallocate\fP(2), \fBlseek\fP(2), \fBposix_fadvise\fP(2) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.41 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。