.\" 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) 2006 Yuichi SATO .\" all rights reserved. .\" Translated 2006-07-13, Yuichi SATO . LDP v2.29 .\" Updated 2010-04-11, Akihiro MOTOKI , LDP v3.24 .\" .TH POSIX_FALLOCATE 3 2009-09-30 "GNU" "Linux Programmer's Manual" .SH 名前 posix_fallocate \- ファイルのスペースを確保する .SH 書式 .nf .B #define _XOPEN_SOURCE 600 .B #include .sp .BI "int posix_fallocate(int " fd ", off_t " offset ", off_t " len ); .fi .SH 説明 関数 .BR posix_fallocate () は、ディスクリプタ .I fd で参照されるファイルに対して、ディスクスペースを確実に確保する。 ディスクスペースは .I offset から始まる .I len バイトの範囲のバイトである。 .BR posix_fallocate () の呼び出しが成功した後、指定された範囲のバイトに対する書き込みは、 ディスクスペースの不足で失敗しないことが保証される。 ファイルのサイズが .IR offset + len より小さい場合、ファイルはこのサイズになるように拡大される。 それ以外の場合、ファイルサイズは変わらない。 .SH 返り値 .BR posix_fallocate () は成功した場合、0 を返す。 失敗した場合、エラー番号を返す。 .I errno が設定されない点に注意すること。 .SH エラー .TP .B EBADF .I fd が有効なディスクリプタでない。 または書き込み用にオープンされていない。 .TP .B EFBIG .I offset+len が最大ファイルサイズを超えている。 .TP .B EINVAL .I offset が 0 未満だったか、 .I len が 0 以下だった。 .TP .B ENODEV .I fd が通常のファイルとして参照されていない。 .TP .B ENOSPC .I fd で参照されるファイルが存在するデバイスに、十分なスペースが残っていない。 .TP .B ESPIPE .I fd がファイルディスクリプタのパイプを参照している。 .SH バージョン .BR posix_fallocate () は glibc 2.1.94 以降で利用可能である。 .SH 準拠 POSIX.1-2001. POSIX.1-2008 では、 .I len が 0 の場合、もしくは .I offset が 0 未満の場合、 .B EINVAL エラーを返すものとされている。 POSIX.1-2001 では、 .I len が 0 未満の場合、もしくは .I offset が 0 未満の場合、 .B EINVAL エラーを返すものとされている。また、 .I len が 0 の場合、 .B EINVAL エラーを返してもよいとされている。 .SH 関連項目 .BR fallocate (2), .BR lseek (2), .BR posix_fadvise (2), .BR feature_test_macros (7)