OSDN Git Service

(split) LDP: Update draft and release (from the previous commit)
[linuxjm/LDP_man-pages.git] / draft / man2 / readlink.2
index 656ca3f..db88f79 100644 (file)
@@ -111,10 +111,9 @@ _ATFILE_SOURCE
 \fIpathname\fP で指定されたパス名が絶対パスの場合、 \fIdirfd\fP は無視される。
 
 .\" commit 65cfc6722361570bfe255698d9cd4dccaf47570d
-Since Linux 2.6.39, \fIpathname\fP can be an empty string, in which case the
-call operates on the file referred to by \fIdirfd\fP (which may have been
-obtained using the \fBopen\fP(2)  \fBO_PATH\fP flag).  In this case, \fIdirfd\fP can
-refer to any type of file, not just a directory.
+Linux 2.6.39 以降では、 \fIpathname\fP に空文字列を指定できる。 その場合、呼び出しは \fIdirfd\fP
+が参照するファイルに対して行われる (\fIdirfd\fP は \fBopen\fP(2) の \fBO_PATH\fP フラグを使って取得できる)。 この場合、
+\fIdirfd\fP はディレクトリだけでなく、ファイルを参照していてもよい。
 .PP
 \fBreadlinkat\fP() の必要性についての説明については \fBopenat\fP(2) を参照。
 .SH 返り値
@@ -176,16 +175,13 @@ refer to any type of file, not just a directory.
 で宣言されていた。現在では、返り値の型は \fIssize_t\fP である (返り値 \fIssize_t\fP は POSIX.1\-2001 で (新たに)
 必須となった)。
 
-Using a statically sized buffer might not provide enough room for the
-symbolic link contents.  The required size for the buffer can be obtained
-from the \fIstat.st_size\fP value returned by a call to \fBlstat\fP(2)  on the
-link.  However, the number of bytes written by \fBreadlink\fP()  and
-\fBreadlinkat\fP()  should be checked to make sure that the size of the
-symbolic link did not increase between the calls.  Dynamically allocating
-the buffer for \fBreadlink\fP()  and \fBreadlinkat\fP()  also addresses a common
-portability problem when using \fIPATH_MAX\fP for the buffer size, as this
-constant is not guaranteed to be defined per POSIX if the system does not
-have such limit.
+静的な大きさのバッファを使うと、 シンボリックリンクの内容を格納するのに十分な領域がない場合がある。 バッファに必要なサイズは、
+そのシンボリックリンクに対して \fBlstat\fP(2) の呼び出しで返される \fIstat.st_size\fP の値から取得できる。 ただし、
+\fBreadlink\fP() や \fBreadlinkat\fP() が書き込んだバイト数をチェックして、
+シンボリックリンクのサイズが二つの呼び出しの間で増えていないことを確認すべきである。 \fBreadlink\fP() や \fBreadlinkat\fP()
+用のバッファを動的に割り当てる方法でも、 バッファサイズとして \fIPATH_MAX\fP を使用する場合に共通する移植性の問題を解決することができる。
+なぜなら、POSIX では、 システムがそのような上限値を定義していない場合には、 \fIPATH_MAX\fP
+が定義されることが保証されていないからである。
 .SH 例
 以下のプログラムは、 \fBreadlink\fP() が必要とするバッファを、
 \fBlstat\fP() が提供する情報に基づいて動的に割り当てる。