OSDN Git Service

(split) LDP: Release pages with over 80% translations.
[linuxjm/LDP_man-pages.git] / release / man2 / lseek.2
index 34b981e..36ac7be 100644 (file)
@@ -1,4 +1,6 @@
+.\" t
 .\" Copyright (c) 1980, 1991 Regents of the University of California.
+.\" and Copyright (c) 2011, Michael Kerrisk <mtk.manpages@gmail.com>
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\"
 .\"     @(#)lseek.2    6.5 (Berkeley) 3/10/91
 .\"
-.\" Modified Fri Jul 23 22:17:00 1993 by Rik Faith <faith@cs.unc.edu>
-.\" Modified 10 June 1995 by Andries Brouwer <aeb@cwi.nl>
-.\" Modified Thu Oct 31 15:18:33 1996 by Eric S. Raymond <esr@thyrsus.com>
-.\" Modified Sat Jan 17 13:00:32 MET 1998 by Michael Haardt
+.\" Modified 1993-07-23 by Rik Faith <faith@cs.unc.edu>
+.\" Modified 1995-06-10 by Andries Brouwer <aeb@cwi.nl>
+.\" Modified 1996-10-31 by Eric S. Raymond <esr@thyrsus.com>
+.\" Modified 1998-01-17 by Michael Haardt
 .\"   <michael@cantor.informatik.rwth-aachen.de>
-.\" Modified Mon Sep 24 16:18:02 CEST 2001 by Michael Haardt <michael@moria.de>
+.\" Modified 2001-09-24 by Michael Haardt <michael@moria.de>
+.\" Modified 2003-08-21 by Andries Brouwer <aeb@cwi.nl>
+.\" 2011-09-18, mtk, Added SEEK_DATA + SEEK_HOLE
 .\"
-.\" Japanese Version Copyright (c) 1997-1998 HANATAKA Shinya
-.\"         all rights reserved.
-.\" Translated 1997-02-23, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
-.\" Modified 1998-05-11, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
-.\" Updated 2001-12-14, Kentaro Shirakata <argrath@ub32.org>
-.\" Updated 2003-09-08, Kentaro Shirakata <argrath@ub32.org>
-.\" Updated 2005-02-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated 2006-03-05, Akihiro MOTOKI, catch up to LDP v2.25
+.\"*******************************************************************
 .\"
-.\"WORD:       end-of-file             ファイルの終端(end-of-file)
+.\" This file was generated with po4a. Translate the source file.
 .\"
-.TH LSEEK 2 2010-09-11 "Linux" "Linux Programmer's Manual"
+.\"*******************************************************************
+.TH LSEEK 2 2011\-09\-25 Linux "Linux Programmer's Manual"
 .SH 名前
 lseek \- ファイルの読み書きオフセットの位置を変える
 .SH 書式
-.B #include <sys/types.h>
+\fB#include <sys/types.h>\fP
 .br
-.B #include <unistd.h>
+\fB#include <unistd.h>\fP
 .sp
-.BI "off_t lseek(int " fd ", off_t " offset ", int " whence );
+\fBoff_t lseek(int \fP\fIfd\fP\fB, off_t \fP\fIoffset\fP\fB, int \fP\fIwhence\fP\fB);\fP
 .SH 説明
-.BR lseek ()
-関数は、ファイルディスクリプタ (descriptor)
-.I fd
-に対応するオープンされたファイルのオフセットを、
-.IR  whence
-に基づき
-.I offset
-引き数の位置へ以下のように変更する:
-.TP
-.B SEEK_SET
-オフセットは
-.I offset
-バイトに設定される。
-.TP
-.B SEEK_CUR
-オフセットは現在位置に
-.I offset
-バイトを足した位置になる。
-.TP
-.B SEEK_END
-オフセットはファイルのサイズに
-.I offset
-バイトを足した位置になる。
+\fBlseek\fP()  関数は、ファイルディスクリプタ (descriptor)  \fIfd\fP に対応するオープンされたファイルのオフセットを、
+\fIwhence\fP に基づき \fIoffset\fP 引き数の位置へ以下のように変更する:
+.TP 
+\fBSEEK_SET\fP
+オフセットは \fIoffset\fP バイトに設定される。
+.TP 
+\fBSEEK_CUR\fP
+オフセットは現在位置に \fIoffset\fP バイトを足した位置になる。
+.TP 
+\fBSEEK_END\fP
+オフセットはファイルのサイズに \fIoffset\fP バイトを足した位置になる。
 .PP
-.BR lseek ()
-関数は、オフセットをファイルの末尾を越えた位置に設定できる
-(但し、これによりファイルのサイズが変わらない)。
-もしデータがこのオフセット位置以降に書き込まれた場合、
-間の空隙の部分 ("穴 (hole)") の読み出しがあると、
-実際にそこにデータを書き込まれるまでは
-NULL バイト (\(aq\\0\(aq) の列が返される。
+\fBlseek\fP()  関数は、オフセットをファイルの末尾を越えた位置に設定できる (但し、これによりファイルのサイズが変わらない)。
+もしデータがこのオフセット位置以降に書き込まれた場合、 間の空隙の部分 ("穴 (hole)") の読み出しがあると、
+実際にそこにデータを書き込まれるまでは NULL バイト (\(aq\e0\(aq) の列が返される。
+.SS "Seeking file data and holes"
+Linux バージョン 3.1 以降では、
+\fIwhence\fP に以下の値も指定することができる。
+.TP 
+\fBSEEK_DATA\fP
+Adjust the file offset to the next location in the file greater than or
+equal to \fIoffset\fP containing data.  If \fIoffset\fP points to data, then the
+file offset is set to \fIoffset\fP.
+.TP 
+\fBSEEK_HOLE\fP
+Adjust the file offset to the next hole in the file greater than or equal to
+\fIoffset\fP.  If \fIoffset\fP points into the middle of a hole, then the file
+offset is set to \fIoffset\fP.  If there is no hole past \fIoffset\fP, then the
+file offset is adjusted to the end of the file (i.e., there is an implicit
+hole at the end of any file).
+.PP
+In both of the above cases, \fBlseek\fP()  fails if \fIoffset\fP points past the
+end of the file.
+
+These operations allow applications to map holes in a sparsely allocated
+file.  This can be useful for applications such as file backup tools, which
+can save space when creating backups and preserve holes, if they have a
+mechanism for discovering holes.
+
+.\" https://lkml.org/lkml/2011/4/22/79
+.\" http://lwn.net/Articles/440255/
+.\" http://blogs.oracle.com/bonwick/entry/seek_hole_and_seek_data
+For the purposes of these operations, a hole is a sequence of zeros that
+(normally) has not been allocated in the underlying file storage.  However,
+a file system is not obliged to report holes, so these operations are not a
+guaranteed mechanism for mapping the storage space actually allocated to a
+file.  (Furthermore, a sequence of zeros that actually has been written to
+the underlying storage may not be reported as a hole.)  In the simplest
+implementation, a file system can support the operations by making
+\fBSEEK_HOLE\fP always return the offset of the end of the file, and making
+\fBSEEK_DATA\fP always return \fIoffset\fP (i.e., even if the location referred to
+by \fIoffset\fP is a hole, it can be considered to consist of data that is a
+sequence of zeros).
 .SH 返り値
-成功した場合、
-.BR lseek ()
-は結果のファイル位置をファイルの先頭からのバイト数で返す。
-エラーの場合、値 \fI(off_t)\ \-1\fP が返され、
-.I errno
-にエラーが指示される。
+成功した場合、 \fBlseek\fP()  は結果のファイル位置をファイルの先頭からのバイト数で返す。 エラーの場合、値 \fI(off_t)\ \-1\fP
+が返され、 \fIerrno\fP にエラーが指示される。
 .SH エラー
-.TP
-.B EBADF
-.I fd
-がオープンされたファイルディスクリプタでない。
-.TP
-.B EINVAL
-.I whence
-が
-.BR SEEK_SET ,
-.BR SEEK_CUR ,
-.B SEEK_END
-のどれでもない。
-または、seek の結果、ファイル・オフセットが負になってしまうか、
-seek 可能なデバイスの末尾を越えてしまう。
-.\" システムによってはキャラクタデバイスやリモートファイルシステムに対して
-.\" 負のオフセットが許されるかもしれない。
-.B EOVERFLOW
-.\" この場合 HP-UX 11 は EINVAL を返す (一方、POSIX.1 は EOVERFLOW を返す)
-結果のファイル・オフセットを
-.I off_t
-型で表現することができない。
-.TP
-.B ESPIPE
-.I fd
-がパイプ、ソケット、FIFO を参照している。
+.TP 
+\fBEBADF\fP
+\fIfd\fP がオープンされたファイルディスクリプタでない。
+.TP 
+\fBEINVAL\fP
+.\" Some systems may allow negative offsets for character devices
+.\" and/or for remote file systems.
+\fIwhence\fP が有効な値ではない。または、seek の結果、ファイルオフセットが負に
+なってしまうか、 seek 可能なデバイスの末尾を越えてしまう。
+.TP 
+\fBEOVERFLOW\fP
+.\" HP-UX 11 says EINVAL for this case (but POSIX.1 says EOVERFLOW)
+結果のファイルオフセットを \fIoff_t\fP 型で表現することができない。
+.TP 
+\fBESPIPE\fP
+\fIfd\fP がパイプ、ソケット、FIFO を参照している。
+.TP 
+\fBENXIO\fP
+\fIwhence\fP が \fBSEEK_DATA\fP か \fBSEEK_HOLE\fP で、
+現在のファイルオフセットがファイルの末尾を超えた位置である。
 .SH 準拠
-SVr4, 4.3BSD, POSIX.1-2001.
-.SH 注意
-この文章で使用した
-.I whence
-は英語として正しくないが、
-歴史的理由によりそのまま使われている。
+SVr4, 4.3BSD, POSIX.1\-2001.
 
-いくつかのデバイスでは seek ができない。
-POSIX はどのデバイスが
-.BR lseek ()
-に対応すべきかは規定していない。
+.\" FIXME . Review http://austingroupbugs.net/view.php?id=415 in the future
+\fBSEEK_DATA\fP and \fBSEEK_HOLE\fP are nonstandard extensions also present in
+Solaris, FreeBSD, and DragonFly BSD; they are proposed for inclusion in the
+next POSIX revision (Issue 8).
+.SH 注意
+いくつかのデバイスでは seek ができない。 POSIX はどのデバイスが \fBlseek\fP()  に対応すべきかは規定していない。
 
-Linux では、 tty デバイスに
-.BR lseek ()
-を使用すると
-\fBESPIPE\fP を返す。
-.\" 他のシステムでは書き込まれた文字の数を返し、
-.\" SEEK_SET を用いてカウンタを設定する。 (書き込まれた文字の。)
+.\" Other systems return the number of written characters,
+.\" using SEEK_SET to set the counter. (Of written characters.)
+Linux では、 tty デバイスに \fBlseek\fP()  を使用すると \fBESPIPE\fP を返す。
 
 古いコードを変換する時は \fIwhence\fP の値を以下のマクロに置き換えること:
 .TS
@@ -156,21 +161,15 @@ L_INCR    SEEK_CUR
 L_XTND SEEK_END
 .TE
 .\" .PP
-.\" .\"O SVr1-3 returns \fIlong\fP instead of \fIoff_t\fP,
-.\" .\"O (ancient) BSD returns \fIint\fP.
-.\" 返り値の型は、SVr1-3 では \fIoff_t\fP ではなく \fIlong\fP であり、
-.\" (古い) BSD では \fIint\fP である。
+.\" SVr1-3 returns \fIlong\fP instead of \fIoff_t\fP,
+.\" (ancient) BSD returns \fIint\fP.
 .PP
-.BR dup (2)
-や
-.BR fork (2)
-で作成されたファイルディスクリプタは、現在のファイル位置ポインタ
-(current file position pointer) を共有しているので、
-このようなファイルで移動を行うと競合状態を引き起こす可能性がある。
+\fBdup\fP(2)  や \fBfork\fP(2)  で作成されたファイルディスクリプタは、現在のファイル位置ポインタ (current file
+position pointer) を共有しているので、 このようなファイルで移動を行うと競合状態を引き起こす可能性がある。
 .SH 関連項目
-.BR dup (2),
-.BR fork (2),
-.BR open (2),
-.BR fseek (3),
-.BR lseek64 (3),
-.BR posix_fallocate (3)
+\fBdup\fP(2), \fBfork\fP(2), \fBopen\fP(2), \fBfseek\fP(3), \fBlseek64\fP(3),
+\fBposix_fallocate\fP(3)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.40 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。