[JM:02574] [POST:DP] LDP man-pages readdir_r.3

アーカイブの一覧に戻る
Akihiro Motoki amoto****@gmail*****
2021年 7月 1日 (木) 13:32:31 JST


LDP_man-pages/po4a/direct/po/ja.po の未完了ページ分の4つ目です。

<STATUS>
stat: DP
ppkg: LDP man-pages
page: readdir_r.3
date: 2021/07/01
mail: amoto****@gmail*****
name: Akihiro Motoki
</STATUS>

.\"O .TH READDIR_R 3  2016-03-01 "" "Linux Programmer's Manual"
.TH READDIR_R 3 2016\-03\-01 "" "Linux Programmer's Manual"
.\"O ----------------------------------------
.\"O .SH NAME
.\"O readdir_r \- read a directory
.SH 名前
readdir_r \- ディレクトリを読み込む
.\"O ----------------------------------------
.\"O .SH SYNOPSIS
.\"O .nf
.\"O .B #include <dirent.h>
.SH 書式
.nf
\fB#include <dirent.h>\fP
.\"O ----------------------------------------
.\"O .PP
.\"O .BI "int readdir_r(DIR *" dirp ", struct dirent *" entry \
.\"O ", struct dirent **" result );
.\"O .fi
.PP
\fBint readdir_r(DIR *\fP\fIdirp\fP\fB, struct dirent
*\fP\fIentry\fP\fB, struct dirent **\fP\fIresult\fP\fB);\fP
.fi
.\"O ----------------------------------------
.\"O .PP
.PP
.\"O ----------------------------------------
.\"O .RS -4
.\"O Feature Test Macro Requirements for glibc (see
.\"O .BR feature_test_macros (7)):
.\"O .ad l
.RS -4
glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
.ad l
.\"O ----------------------------------------
.\"O .RE
.RE
.\"O ----------------------------------------
.\"O .PP
.\"O .BR readdir_r ():
.PP
\fBreaddir_r\fP():
.\"O ----------------------------------------
.\"O .RS 4
.\"O _POSIX_C_SOURCE
.\"O     || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
.RS 4
_POSIX_C_SOURCE
    || /* glibc 2.19 以前: */ _BSD_SOURCE || _SVID_SOURCE
.\"O ----------------------------------------
.\"O .RE
.\"O .ad b
.RE
.ad b
.\"O ----------------------------------------
.\"O .SH DESCRIPTION
.\"O This function is deprecated; use
.\"O .BR readdir (3)
.\"O instead.
.SH 説明
この関数は非推奨である。代わりに \fBreaddir\fP(3) を使用すること。
.\"O ----------------------------------------
.\"O .PP
.\"O The
.\"O .BR readdir_r ()
.\"O function was invented as a reentrant version of
.\"O .BR readdir (3).
.\"O It reads the next directory entry from the directory stream
.\"O .IR dirp ,
.\"O and returns it in the caller-allocated buffer pointed to by
.\"O .IR entry .
.\"O For details of the
.\"O .IR dirent
.\"O structure, see
.\"O .BR readdir (3).
.PP
\fBreaddir_r\fP() 関数は \fBreaddir\fP(3)
のリエントラント版として導入された。この関数はディレクトリストリーム \fIdirp\fP
から次のディレクトリエントリーを読み込み、 \fIentry\fP が指す呼び出し元が割り当てたバッファーにそのエントリーを格納して返す。
\fIdirent\fP
構造体の詳細は \fBreaddir\fP(3) を参照。
.\"O ----------------------------------------
.\"O .PP
.\"O A pointer to the returned buffer is placed in
.\"O .IR *result ;
.\"O if the end of the directory stream was encountered,
.\"O then NULL is instead returned in
.\"O .IR *result .
.PP
結果を返すバッファへのポインターが \fI*result\fP に格納される。ディレクトリストリームの末尾に達した場合は、NULL が代わりに
\fI*result\fP で返される。
.\"O ----------------------------------------
.\"O .PP
.\"O It is recommended that applications use
.\"O .BR readdir (3)
.\"O instead of
.\"O .BR readdir_r ().
.\"O Furthermore, since version 2.24, glibc deprecates
.\"O .BR readdir_r ().
.\"O The reasons are as follows:
.PP
アプリケーションでは \fBreaddir_r\fP() の代わりに \fBreaddir\fP(3) を使用することを推奨する。さらに、glibc 2.24
以降では \fBreaddir_r\fP() は非推奨となっている。理由は以下の通りである。
.\"O ----------------------------------------
.\"O .IP * 3
.\"O On systems where
.\"O .BR NAME_MAX
.\"O is undefined, calling
.\"O .BR readdir_r ()
.\"O may be unsafe because the interface does not allow the caller to specify
.\"O the length of the buffer used for the returned directory entry.
.IP * 3
\fBNAME_MAX\fP が定義されていないシステムでは、 \fBreaddir_r\fP()
の呼び出しは安全ではない。このインターフェースでは、呼び出し元がディレクトリエントリーを返す際に使用されるバッファの長さを指定することができないからである。
.\"O ----------------------------------------
.\"O .IP *
.\"O On some systems,
.\"O .BR readdir_r ()
.\"O can't read directory entries with very long names.
.\"O When the glibc implementation encounters such a name,
.\"O .BR readdir_r ()
.\"O fails with the error
.\"O .B ENAMETOOLONG
.\"O .IR "after the final directory entry has been read" .
.\"O On some other systems,
.\"O .BR readdir_r ()
.\"O may return a success status, but the returned
.\"O .IR d_name
.\"O field may not be null terminated or may be truncated.
.IP *
いくつかのシステムでは、 \fBreaddir_r\fP() は非常に長い名前のディレクトリエントリーを読み込むことができない。 glibc
の実装ではこのような名前に遭遇した場合、 \fBreaddir_r\fP() は \fI最後のディレクトリエントリーを読み込んだ後\fP エラー
\fBENAMETOOLONG\fP で失敗する。他のいくつかのシステムでは、 \fBreaddir_r\fP() が成功ステータスを返しても、返された
\fId_name\fP フィールドがヌル終端されていなかったり、文字列が途中までで切り詰められていたりすることがある。
.\"O ----------------------------------------
.\"O .IP *
.\"O In the current POSIX.1 specification (POSIX.1-2008),
.\"O .BR readdir (3)
.\"O is not required to be thread-safe.
.\"O However, in modern implementations (including the glibc implementation),
.\"O concurrent calls to
.\"O .BR readdir (3)
.\"O that specify different directory streams are thread-safe.
.\"O Therefore, the use of
.\"O .BR readdir_r ()
.\"O is generally unnecessary in multithreaded programs.
.\"O In cases where multiple threads must read from the same directory stream,
.\"O using
.\"O .BR readdir (3)
.\"O with external synchronization is still preferable to the use of
.\"O .BR readdir_r (),
.\"O for the reasons given in the points above.
.IP *
現在の POSIX.1 標準 (POSIX.1\-2008) では、 \fBreaddir\fP(3)
がスレッドセーフであることは求められていない。しかしながら、新し目の実装 (glibc による実装も含む) では、異なるディレクトリストリームに対する
\fBreaddir\fP(3) の同時並行の呼び出しはスレッドセーフである。したがって、マルチスレッドプログラムにおいて \fBreaddir_r\fP()
の使用は不要である。複数のスレッドが同じディレクトリストリームから読み込みを行う必要がある場合も、上記で挙げた理由から、非推奨の
\fBreaddir_r\fP() 関数を使用するよりも、外部同期を用いた \fBreaddir\fP(3) を使う方が推奨される。
.\"O ----------------------------------------
.\"O .IP *
.\"O It is expected that a future version of POSIX.1
.\"O will make
.\"O .BR readdir_r ()
.\"O obsolete, and require that
.\"O .BR readdir (3)
.\"O be thread-safe when concurrently employed on different directory streams.
.IP *
POSIX.1 の将来のバージョンでは、 \fBreaddir_r\fP() は廃止予定 (obsolete) となり、 \fBreaddir\fP(3)
は異なるディレクトリストリームに対して同時に使用された際にスレッドセーフであることが必須となる予定である。
.\"O ----------------------------------------
.\"O .SH RETURN VALUE
.\"O The
.\"O .BR readdir_r ()
.\"O function returns 0 on success.
.\"O On error, it returns a positive error number (listed under ERRORS).
.\"O If the end of the directory stream is reached,
.\"O .BR readdir_r ()
.\"O returns 0, and returns NULL in
.\"O .IR *result .
.SH 返り値
成功すると、 \fBreaddir_r\fP()  関数は 0 を返す。 エラーの場合、(「エラー」の節のリストに載っている) 正のエラー番号を返す。
ディレクトリストリームの末尾に達した場合、 \fBreaddir_r\fP()  は返り値として 0 を返し、 \fI*result\fP に NULL
を格納する。
.\"O ----------------------------------------
.\"O .SH ERRORS
.SH エラー
.\"O ----------------------------------------
.\"O .TP
.\"O .B EBADF
.\"O Invalid directory stream descriptor \fIdirp\fP.
.TP
\fBEBADF\fP
ディレクトリストリームディスクリプター \fIdirp\fP が無効である。
.\"O ----------------------------------------
.\"O .TP
.\"O .B ENAMETOOLONG
.\"O A directory entry whose name was too long to be read was encountered.
.TP
\fBENAMETOOLONG\fP
読み込むには名前が長過ぎるディレクトリエントリーに遭遇した。
.\"O ----------------------------------------
.\"O .SH ATTRIBUTES
.\"O For an explanation of the terms used in this section, see
.\"O .BR attributes (7).
.\"O .TS
.\"O allbox;
.\"O lb lb lb
.\"O l l l.
.\"O Interface Attribute Value
.\"O T{
.\"O .BR readdir_r ()
.\"O T} Thread safety MT-Safe
.\"O .TE
.SH 属性
この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。
.TS
allbox;
lb lb lb
l l l.
インターフェース 属性 値
T{
\fBreaddir_r\fP()
T} Thread safety MT\-Safe
.TE
.\"O ----------------------------------------
.\"O .SH CONFORMING TO
.\"O POSIX.1-2001, POSIX.1-2008.
.SH 準拠
POSIX.1\-2001, POSIX.1\-2008.
.\"O ----------------------------------------
.\"O .SH SEE ALSO
.\"O .BR readdir (3)
.SH 関連項目
\fBreaddir\fP(3)
.\"O ----------------------------------------
.\"O .SH COLOPHON
.\"O This page is part of release 5.10 of the Linux
.\"O .I man-pages
.\"O project.
.\"O A description of the project,
.\"O information about reporting bugs,
.\"O and the latest version of this page,
.\"O can be found at
.\"O \%https://www.kernel.org/doc/man\-pages/.
.SH この文書について
この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は
\%https://www.kernel.org/doc/man\-pages/ に書かれている。
.\"O ----------------------------------------


linuxjm-discuss メーリングリストの案内
アーカイブの一覧に戻る