X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=draft%2Fman2%2Ffallocate.2;h=edd3780bdafde7e8a02ec889bb0fa3ec7f601be0;hb=c1dfa2f6ab1bbed84992d3c59ee9925f4d453668;hp=89f413b6888661b1202a00950977467ad90cde9a;hpb=7e089fcc022461849bbc09437103cc337a88dd9c;p=linuxjm%2FLDP_man-pages.git diff --git a/draft/man2/fallocate.2 b/draft/man2/fallocate.2 index 89f413b6..edd3780b 100644 --- a/draft/man2/fallocate.2 +++ b/draft/man2/fallocate.2 @@ -1,234 +1,125 @@ .\" Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved .\" Written by Dave Chinner +.\" +.\" %%%LICENSE_START(GPLv2_ONELINE) .\" May be distributed as per GNU General Public License version 2. +.\" %%%LICENSE_END +.\" +.\" 2011-09-19: Added FALLOC_FL_PUNCH_HOLE +.\" 2011-09-19: Substantial restructuring of the page +.\" +.\"******************************************************************* .\" -.\" Japanese Version Copyright (c) 2007 Akihiro MOTOKI -.\" all rights reserved. -.\" Translated 2007-10-16, Akihiro MOTOKI , LDP v2.66 -.\" Updated 2008-10-13, Akihiro MOTOKI , LDP v3.11 -.\" -.TH FALLOCATE 2 2010-09-10 "Linux" "Linux Programmer's Manual" -.\"O .SH NAME -.SH ̾Á° -.\"O fallocate \- manipulate file space -fallocate \- ¥Õ¥¡¥¤¥ë¶õ´Ö¤ÎÁàºî -.\"O .SH SYNOPSIS -.SH ½ñ¼° +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH FALLOCATE 2 2013\-06\-10 Linux "Linux Programmer's Manual" +.SH 名前 +fallocate \- ファイル空間の操作 +.SH 書式 .nf -.\"O .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" -.BR "#define _GNU_SOURCE" " /* feature_test_macros(7) »²¾È */" -.B #include +\fB#define _GNU_SOURCE\fP /* feature_test_macros(7) 参照 */ +\fB#include \fP -.BI "int fallocate(int " fd ", int " mode ", off_t " offset \ -", off_t " len ");" +\fBint fallocate(int \fP\fIfd\fP\fB, int \fP\fImode\fP\fB, off_t \fP\fIoffset\fP\fB, off_t \fP\fIlen\fP\fB);\fP .fi -.\"O .SH DESCRIPTION -.SH ÀâÌÀ -.\"O This is a nonportable, Linux-specific system call. -.\"O For the portable, POSIX.1-specified method of ensuring that space -.\"O is allocated for a file, see -.\"O .BR posix_fallocate (). -¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢°Ü¿¢À­¤Î¤Ê¤¤¡¢Linux ¸ÇÍ­¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ç¤¢¤ë¡£ -°Ü¿¢À­¤¬É¬Íפʾì¹ç¤Ï¡¢¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ¥Ç¥£¥¹¥¯¶õ´Ö¤ò³Î¼Â¤Ë³ÎÊݤ¹¤ë¤¿¤á¤Ë¡¢ -POSIX.1 ¤Çµ¬Äꤵ¤ì¤¿ÊýË¡¤Ç¤¢¤ë -.BR posix_fallocate (3) -¤ò»È¤¦¤³¤È¡£ +.SH 説明 +このシステムコールは、移植性のない、Linux 固有のシステムコールである。 移植性が必要な場合は、ファイルに対してディスク空間を確実に確保するために、 +POSIX.1 で規定された方法である \fBposix_fallocate\fP(3) を使うこと。 -.\"O .BR fallocate () -.\"O allows the caller to directly manipulate the allocated disk space -.\"O for the file referred to by -.\"O .I fd -.\"O for the byte range starting at -.\"O .I offset -.\"O and continuing for -.\"O .I len -.\"O bytes. -.BR fallocate () -¤ò»È¤¦¤È¡¢ -.I fd -¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿¥Ç¥£¥¹¥¯¶õ´Ö¤òľÀÜÁàºî¤Ç¤­¤ë¡£ -ÁàºîÂоݤϡ¢ -.I offset -¤«¤é»Ï¤Þ¤ëŤµ -.I len -¥Ð¥¤¥È¤ÎÎΰè¤Ç¤¢¤ë¡£ +\fBfallocate\fP() を使うと、 \fIfd\fP が参照するファイルに割り当てられたディスク空間を直接操作できる。 操作対象は、 +\fIoffset\fP から始まる長さ \fIlen\fP バイトの領域である。 -.\"O The -.\"O .I mode -.\"O argument determines the operation to be performed on the given range. -.\"O Currently only one flag is supported for -.\"O .IR mode : -.I mode -°ú¤­¿ô¤Ï¡¢»ØÄꤵ¤ì¤¿Îΰè¤ËÂФ·¤Æ¼Â¹Ô¤¹¤ëÁàºî¤ò»ØÄꤹ¤ë¡£ -¸½ºß¤Î¤È¤³¤í¡¢ -.I mode -¤Ë»ØÄê¤Ç¤­¤ë¥Õ¥é¥°¤Ï°Ê²¼¤Î°ì¤Ä¤À¤±¤Ç¤¢¤ë¡£ -.TP -.B FALLOC_FL_KEEP_SIZE -.\"O This flag allocates and initializes to zero the disk space -.\"O within the range specified by -.\"O .I offset -.\"O and -.\"O .IR len . -.\"O After a successful call, subsequent writes into this range -.\"O are guaranteed not to fail because of lack of disk space. -¤³¤Î¥Õ¥é¥°¤Ï¡¢ -.I offset -¤È -.I len -¤Ç»ØÄꤵ¤ì¤¿Îΰè¤Î¥Ç¥£¥¹¥¯¶õ´Ö¤ò³ä¤êÅö¤Æ¡¢¤½¤Î¶õ´Ö¤ò 0 ¤Ç½é´ü²½¤¹¤ë¡£ -¸Æ¤Ó½Ð¤·¤¬À®¸ù¤¹¤ë¤È¡¢¤½¤ì¤Ë³¤¤¤Æ¤³¤ÎÎΰè¤Ø¤Î½ñ¤­¹þ¤ß¤¬¹Ô¤ï¤ì¤ë¤¬¡¢ -¥Ç¥£¥¹¥¯¶õ´Ö¤ÎÉÔ­¤Ë¤è¤ë½ñ¤­¹þ¤ß¼ºÇÔ¤¬È¯À¸¤·¤Ê¤¤¤³¤È¤¬Êݾڤµ¤ì¤ë¡£ -.\"O Preallocating zeroed blocks beyond the end of the file -.\"O is useful for optimizing append workloads. -.\"O Preallocating blocks does not change -.\"O the file size (as reported by -.\"O .BR stat (2)) -.\"O even if it is less than -.\"O .IR offset + len . -¥Õ¥¡¥¤¥ëËöÈø¤è¤ê¸å¤í¤ÎÎΰè¤Ë¤Ä¤¤¤Æ 0 ¤ÇËä¤á¤¿¥Ö¥í¥Ã¥¯¤òÁ°¤â¤Ã¤Æ -³ä¤êÅö¤Æ¤Æ¤ª¤¯¤³¤È¤Ï¡¢Äɵ­ (append) ¤Îºî¶ÈÉé²Ù¤òºÇŬ²½¤¹¤ë¤Î¤Ë -Í­ÍѤǤ¢¤ë¡£ -¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤¬ -.IR offset + len -¤è¤ê¤â¾®¤µ¤¤¾ì¹ç¤Ç¤¢¤Ã¤Æ¤â¡¢¥Ö¥í¥Ã¥¯¤ÎÁ°¤â¤Ã¤Æ¤Î³ä¤êÅö¤Æ¤Ë¤è¤ê -.RB ( stat (2) -¤¬ÊÖ¤¹) ¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤ÏÊѹ¹¤µ¤ì¤ë¤³¤È¤Ï¤Ê¤¤¡£ -.\" -.\" Note from Amit Arora: -.\" There were few more flags which were discussed, but none of -.\" them have been finalized upon. Here are these flags: -.\" FA_FL_DEALLOC, FA_FL_DEL_DATA, FA_FL_ERR_FREE, FA_FL_NO_MTIME, -.\" FA_FL_NO_CTIME -.\" All of the above flags were debated upon and we can not say -.\" if any/which one of these flags will make it to the later kernels. -.PP -.\"O If -.\"O .B FALLOC_FL_KEEP_SIZE -.\"O flag is not specified in -.\"O .IR mode , -.\"O the default behavior is almost same as when this flag is specified. -.\"O The only difference is that on success, -.\"O the file size will be changed if -.\"O .I "offset + len" -.\"O is greater than the file size. -.\"O This default behavior closely resembles the behavior of the -.\"O .BR posix_fallocate (3) -.\"O library function, -.\"O and is intended as a method of optimally implementing that function. -.B FALLOC_FL_KEEP_SIZE -¥Õ¥é¥°¤¬ -.I mode -¤Ë»ØÄꤵ¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¡¢¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤Ï -.B FALLOC_FL_KEEP_SIZE -¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤È¤Û¤È¤ó¤ÉƱ¤¸¤È¤Ê¤ë¡£ -Í£°ì¤Î°ã¤¤¤Ï¡¢ -.I "offset + len" -¤¬¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤è¤ê¤âÂ礭¤«¤Ã¤¿¾ì¹ç¡¢¸Æ¤Ó½Ð¤·¤¬À®¸ù¤¹¤ë¤È -¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤¬Êѹ¹¤µ¤ì¤ëÅÀ¤Ç¤¢¤ë¡£ -¤³¤Î¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤Ï¡¢¥é¥¤¥Ö¥é¥ê´Ø¿ô -.BR posix_fallocate (3) -¤ÎÆ°ºî¤ÈÈó¾ï¤Ë»÷¤Æ¤¤¤ë¡£¤³¤ì¤Ï -.BR posix_fallocate (3) -¤òºÇŬ¤Ë¼ÂÁõ¤¹¤ë¼êÃʤòÄ󶡤¹¤ë¤³¤È¤òÌÜŪ¤È¤·¤Æ¤¤¤ë¤«¤é¤Ç¤¢¤ë¡£ +\fImode\fP 引き数は、指定された領域に対して実行する操作を指定する。 +サポートされている操作の詳細は以下のサブセクションで説明する。 +.SS ディスク領域の割り当て +\fBfallocate\fP() のデフォルトの動作 (つまり \fImode\fP が 0 の場合) は、 +\fIoffset\fP と \fIlen\fP で指定された範囲のディスク領域の割り当てと初期化を行う。 +\fIoffset\fP+\fIlen\fP がファイルサイズよりも大きかった場合、 +(\fBstat\fP(2) で報告される) ファイルサイズが変更される。このデフォルトの動作は、 +ライブラリ関数 \fBposix_fallocate\fP(3) の動作と非常に似ている。これは、 +このシステムコールが \fBposix_fallocate\fP(3) を最適に実装する手段を提供する +ことを目的としているからである。 + +呼び出しが成功した場合、 +\fIoffset\fP と \fIlen\fP で指定された範囲へのそれ以降の書き込みでは、 +ディスクの領域不足での書き込み失敗が起こらないことが保証される。 + +\fBFALLOC_FL_KEEP_SIZE\fP フラグが \fImode\fP に指定された場合、このシステムコール +の動作は似ているが、 \fIoffset\fP+\fIlen\fP がファイルサイズよりも大きい場合で +あってもファイルサイズは変更されない点が異なる。この場合のファイルの末尾 +よりも後ろの前もって割り当てられた 0 で埋められたブロックは、ファイルへの +追記を最適化したい場合に役に立つ。 .PP -.\"O Because allocation is done in block size chunks, -.\"O .BR fallocate () -.\"O may allocate a larger range than that which was specified. -³ä¤êÅö¤Æ¤Ï¥Ö¥í¥Ã¥¯¥µ¥¤¥ºÃ±°Ì¤Ç¹Ô¤ï¤ì¤ë¤¿¤á¡¢ -.BR fallocate () -¤Ï»ØÄꤵ¤ì¤¿¤è¤ê¤âÂ礭¤ÊÎΰè¤ò³ä¤êÅö¤Æ¤ë¤³¤È¤¬¤¢¤ë¡£ -.\"O .SH RETURN VALUE -.SH ÊÖ¤êÃÍ -.\"O .BR fallocate () -.\"O returns zero on success, and -1 on failure. -.BR fallocate () -¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤·¡¢¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤¹¡£ -.\"O .SH ERRORS -.SH ¥¨¥é¡¼ -.TP -.B EBADF -.\"O .I fd -.\"O is not a valid file descriptor, or is not opened for writing. -.I fd -¤¬Í­¸ú¤Ê¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ê¤¤¤«¡¢ -½ñ¤­¹þ¤ßÍѤȤ·¤Æ¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤Ê¤¤¡£ -.TP -.B EFBIG -.\"O .IR offset + len -.\"O exceeds the maximum file size. -.I offset + len -¤¬¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤ÎºÇÂçÃͤè¤ê¤âÂ礭¤¤¡£ -.TP -.B EINTR -.\"O A signal was caught during execution. -¼Â¹ÔÃæ¤Ë¥·¥°¥Ê¥ë¤¬Ê᪤µ¤ì¤¿¡£ -.TP -.B EINVAL -.\"O .I offset -.\"O was less than 0, or -.\"O .I len -.\"O was less than or equal to 0. -.I offset -¤¬ 0 ̤Ëþ¤Ç¤¢¤ë¤«¡¢ -.I len -¤¬ 0 °Ê²¼¤Ç¤¢¤ë¡£ -.TP -.B EIO -.\"O An I/O error occurred while reading from or writing to a file system. -¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤È¤ÎÆɤ߽ñ¤­Ãæ¤ËÆþ½ÐÎÏ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£ -.TP -.B ENODEV -.\"O .I fd -.\"O does not refer to a regular file or a directory. -.\"O (If -.\"O .I fd -.\"O is a pipe or FIFO, a different error results.) -.I fd -¤¬Ä̾ï¤Î¥Õ¥¡¥¤¥ë¤«¥Ç¥£¥ì¥¯¥È¥ê¤ò»²¾È¤·¤Æ¤¤¤Ê¤¤ -.RI ( fd -¤¬¥Ñ¥¤¥×¤ä FIFO ¤ò»²¾È¤·¤Æ¤¤¤ë¾ì¹ç¡¢Ê̤Υ¨¥é¡¼¤¬È¯À¸¤¹¤ë)¡£ -.TP -.B ENOSPC -.\"O There is not enough space left on the device containing the file -.\"O referred to by -.\"O .IR fd . -.I fd -¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤ò´Þ¤à¥Ç¥Ð¥¤¥¹¤Ë½½Ê¬¤Ê¶õ¤­Îΰ褬¤Ê¤¤¡£ -.TP -.B ENOSYS -.\"O The file system containing the file referred to by -.\"O .I fd -.\"O does not support this operation. -.I fd -¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤ò´Þ¤à¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬ -»ØÄꤵ¤ì¤¿Áàºî¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¡£ -.TP -.B EOPNOTSUPP -.\"O The -.\"O .I mode -.\"O is not supported by the file system containing the file referred to by -.\"O .IR fd . -.I fd -¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤ò´Þ¤à¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬ -.I mode -¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¡£ -.\"O .SH VERSIONS -.SH ¥Ð¡¼¥¸¥ç¥ó -.\"O .BR fallocate () -.\"O is available on Linux since kernel 2.6.23. -.\"O Support is provided by glibc since version 2.10. -.BR fallocate () -¤Ï¥«¡¼¥Í¥ë 2.6.23 °Ê¹ß¤Î Linux ¤ÇÍøÍѲÄǽ¤Ç¤¢¤ë¡£ -glibc ¤Ç¤ÎÂбþ¤Ï¥Ð¡¼¥¸¥ç¥ó 3.10 °Ê¹ß¤Ç¹Ô¤ï¤ì¤Æ¤¤¤ë¡£ -.\"O .SH CONFORMING TO -.SH ½àµò -.\"O .BR fallocate () -.\"O is Linux-specific. -.BR fallocate () -¤Ï Linux ¸ÇÍ­¤Ç¤¢¤ë¡£ -.\"O .SH SEE ALSO -.SH ´ØÏ¢¹àÌÜ -.BR ftruncate (2), -.BR posix_fadvise (3), -.BR posix_fallocate (3) +割り当てはブロックサイズ単位で行われるため、 \fBfallocate\fP() は指定されたより +も大きなディスク領域を割り当てることがある。 +.SS ファイル空間の割り当て解除 +\fBFALLOC_FL_PUNCH_HOLE\fP フラグ (Linux 2.6.38 以降で利用可能) を \fImode\fP に指定すると、 +\fIoffset\fP で始まる \fIlen\fP バイトの領域の空間を解放する (ホールを作成する)。 指定された範囲のうち、 +部分的に使用しているファイルシステムブロックは 0 で埋められ、 全体を使用しているファイルシステムブロックはそのファイルから削除される。 +呼び出しが成功すると、 これ以降のこの範囲からの読み出しでは 0 を返す。 + +\fBFALLOC_FL_PUNCH_HOLE\fP フラグは \fBFALLOC_FL_KEEP_SIZE\fP と論理和 (OR) をとって \fImode\fP +に指定しなければならない。 つまり、 ファイル末尾の punch off を行った場合でも、 (\fBstat\fP(2) で報告される) +ファイルサイズが変化しない。 + +すべてのファイルシステムで \fBFALLOC_FL_PUNCH_HOLE\fP がサポートされているわけではない。 +ファイルシステムがこの操作をサポートしていない場合は、 エラーが返る。 +.SH 返り値 +成功の場合、 \fBfallocate\fP() は 0 を返す。 エラーの場合、\-1 を返し、 \fIerror\fP にエラーを示す値を設定する。 +.SH エラー +.TP +\fBEBADF\fP +\fIfd\fP が有効なファイルディスクリプタでないか、 書き込み用としてオープンされていない。 +.TP +\fBEFBIG\fP +\fIoffset + len\fP がファイルサイズの最大値よりも大きい。 +.TP +\fBEINTR\fP +実行中にシグナルが捕捉された。 +.TP +\fBEINVAL\fP +.\" FIXME (raise a kernel bug) Probably the len==0 case should be +.\" a no-op, rather than an error. That would be consistent with +.\" similar APIs for the len==0 case. +.\" See "Re: [PATCH] fallocate.2: add FALLOC_FL_PUNCH_HOLE flag definition" +.\" 21 Sep 2012 +.\" http://thread.gmane.org/gmane.linux.file-systems/48331/focus=1193526 +\fIoffset\fP が 0 未満だったか、 \fIlen\fP が 0 以下だった。 +.TP +\fBEIO\fP +ファイルシステムとの読み書き中に入出力エラーが発生した。 +.TP +\fBENODEV\fP +\fIfd\fP が通常のファイルかディレクトリを参照していない (\fIfd\fP がパイプや FIFO を参照している場合、別のエラーが発生する)。 +.TP +\fBENOSPC\fP +\fIfd\fP が参照するファイルを含むデバイスに十分な空き領域がない。 +.TP +\fBENOSYS\fP +このカーネルでは \fBfallocate\fP() は実装されていない。 +.TP +\fBEOPNOTSUPP\fP +\fIfd\fP が参照するファイルを含むファイルシステムが 指定された操作を +サポートしていない。 \fIfd\fP が参照するファイルを含むファイルシステムが +\fImode\fP をサポートしていない。 +.TP +\fBEPERM\fP +\fIfd\fP が参照するファイルに変更不可 (immutable) の属性が付いている (\fBchattr\fP(1) 参照)。 \fImode\fP に +\fBFALLOC_FL_PUNCH_HOLE\fP が指定されたが、 \fIfd\fP が参照するファイルに追加のみ (append\-only) +の属性が付いている (\fBchattr\fP(1) 参照)。 +.TP +\fBESPIPE\fP +\fIfd\fP がパイプか FIFO を参照している。 +.SH バージョン +.\" See http://sourceware.org/bugzilla/show_bug.cgi?id=14964 +\fBfallocate\fP() はカーネル 2.6.23 以降の Linux で利用可能である。 glibc での対応はバージョン 3.10 +以降で行われている。 \fBFALLOC_FL_*\fP が glibc のヘッダファイルで定義されているのは、バージョン 2.18 以降のみである。 +.SH 準拠 +\fBfallocate\fP() は Linux 固有である。 +.SH 関連項目 +\fBfallocate\fP(1), \fBftruncate\fP(2), \fBposix_fadvise\fP(3), \fBposix_fallocate\fP(3) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。