[JM:02647] [POST:DP] LDP man-pages opendir.3

アーカイブの一覧に戻る
Akihiro Motoki amoto****@gmail*****
2021年 7月 8日 (木) 22:11:35 JST


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

.\"O .TH OPENDIR 3  2017-09-15 "GNU" "Linux Programmer's Manual"
.TH OPENDIR 3 2017\-09\-15 GNU "Linux Programmer's Manual"
.\"O ----------------------------------------
.\"O .SH NAME
.\"O opendir, fdopendir \- open a directory
.SH 名前
opendir, fdopendir \- ディレクトリをオープンする
.\"O ----------------------------------------
.\"O .SH SYNOPSIS
.\"O .nf
.\"O .B #include <sys/types.h>
.\"O .B #include <dirent.h>
.SH 書式
.nf
\fB#include <sys/types.h>\fP
\fB#include <dirent.h>\fP
.\"O ----------------------------------------
.\"O .PP
.\"O .BI "DIR *opendir(const char *" name );
.\"O .BI "DIR *fdopendir(int " fd );
.\"O .fi
.PP
\fBDIR *opendir(const char *\fP\fIname\fP\fB);\fP
\fBDIR *fdopendir(int \fP\fIfd\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)):
.RS -4
glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
.\"O ----------------------------------------
.\"O .RE
.RE
.\"O ----------------------------------------
.\"O .PP
.\"O .BR fdopendir ():
.PP
\fBfdopendir\fP():
.\"O ----------------------------------------
.\"O .PD 0
.\"O .ad l
.PD 0
.ad l
.\"O ----------------------------------------
.\"O .RS 4
.RS 4
.\"O ----------------------------------------
.\"O .TP 4
.\"O Since glibc 2.10:
.\"O _POSIX_C_SOURCE\ >=\ 200809L
.TP  4
glibc 2.10 以降:
_POSIX_C_SOURCE\ >=\ 200809L
.\"O ----------------------------------------
.\"O .TP
.\"O Before glibc 2.10:
.\"O _GNU_SOURCE
.TP
glibc 2.10 より前:
_GNU_SOURCE
.\"O ----------------------------------------
.\"O .RE
.\"O .ad
.RE
.ad
.\"O ----------------------------------------
.\"O .PD
.PD
.\"O ----------------------------------------
.\"O .SH DESCRIPTION
.\"O The
.\"O .BR opendir ()
.\"O function opens a directory stream corresponding to the
.\"O directory \fIname\fP, and returns a pointer to the directory stream.
.\"O The stream is positioned at the first entry in the directory.
.SH 説明
\fBopendir\fP() 関数は、ディレクトリ \fIname\fP
に対応するディレクトリストリームをオープンし、そのストリームへのポインターを返す。ストリームの位置はディレクトリの先頭のエントリーに設定される。
.\"O ----------------------------------------
.\"O .PP
.\"O The
.\"O .BR fdopendir ()
.\"O function
.\"O is like
.\"O .BR opendir (),
.\"O but returns a directory stream for the directory referred
.\"O to by the open file descriptor
.\"O .IR fd .
.\"O After a successful call to
.\"O .BR fdopendir (),
.\"O .I fd
.\"O is used internally by the implementation,
.\"O and should not otherwise be used by the application.
.PP
\fBfdopendir\fP() 関数は \fBopendir\fP() と同様だが、オープン済みのファイルディスクリプター \fIfd\fP
により参照されるディレクトリに対するディレクトリストリームを返す。 \fBfdopendir\fP() の呼び出しが成功した後は、 \fIfd\fP
は実装の内部で使用される。アプリケーションは \fIfd\fP を他の場面で使用すべきではない。
.\"O ----------------------------------------
.\"O .SH RETURN VALUE
.\"O The
.\"O .BR opendir ()
.\"O and
.\"O .BR fdopendir ()
.\"O functions return a pointer to the directory stream.
.\"O On error, NULL is returned, and
.\"O .I errno
.\"O is set appropriately.
.SH 返り値
関数 \fBopendir\fP() と \fBfdopendir\fP() はディレクトリストリームへのポインターを返す。 エラーの場合は、NULL が返り、
\fIerrno\fP が適切に設定される。
.\"O ----------------------------------------
.\"O .SH ERRORS
.SH エラー
.\"O ----------------------------------------
.\"O .TP
.\"O .B EACCES
.\"O Permission denied.
.TP
\fBEACCES\fP
アクセス権限がない。
.\"O ----------------------------------------
.\"O .TP
.\"O .B EBADF
.\"O .I fd
.\"O is not a valid file descriptor opened for reading.
.TP
\fBEBADF\fP
\fIfd\fP が読み出し用にオープンされた、有効なファイルディスクリプターではない。
.\"O ----------------------------------------
.\"O .TP
.\"O .B EMFILE
.\"O The per-process limit on the number of open file descriptors has
been reached.
.TP
\fBEMFILE\fP
オープンされたファイルディスクリプター数がプロセス単位の上限に達している。
.\"O ----------------------------------------
.\"O .TP
.\"O .B ENFILE
.\"O The system-wide limit on the total number of open files has been reached.
.TP
\fBENFILE\fP
オープンされたファイルの総数がシステム全体の上限に達している。
.\"O ----------------------------------------
.\"O .TP
.\"O .B ENOENT
.\"O Directory does not exist, or \fIname\fP is an empty string.
.TP
\fBENOENT\fP
ディレクトリが存在しないか、または \fIname\fP が空文字列である。
.\"O ----------------------------------------
.\"O .TP
.\"O .B ENOMEM
.\"O Insufficient memory to complete the operation.
.TP
\fBENOMEM\fP
操作を完了するのに十分なメモリーがない。
.\"O ----------------------------------------
.\"O .TP
.\"O .B ENOTDIR
.\"O \fIname\fP is not a directory.
.TP
\fBENOTDIR\fP
\fIname\fP はディレクトリではない。
.\"O ----------------------------------------
.\"O .SH VERSIONS
.\"O .BR fdopendir ()
.\"O is available in glibc since version 2.4.
.SH バージョン
\fBfdopendir\fP()  は glibc 2.4 以降で利用可能である。
.\"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 lbw22 lb lb
.\"O l l l.
.\"O Interface Attribute Value
.\"O T{
.\"O .BR opendir (),
.\"O .BR fdopendir ()
.\"O T} Thread safety MT-Safe
.\"O .TE
.SH 属性
この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。
.TS
allbox;
lbw22 lb lb
l l l.
インターフェース 属性 値
T{
\fBopendir\fP(),
\fBfdopendir\fP()
T} Thread safety MT\-Safe
.TE
.\"O ----------------------------------------
.\"O .SH CONFORMING TO
.\"O .BR opendir ()
.\"O is present on SVr4, 4.3BSD, and specified in POSIX.1-2001.
.\"O .BR fdopendir ()
.\"O is specified in POSIX.1-2008.
.SH 準拠
\fBopendir\fP()  は SVr4 と 4.3BSD に存在し、 POSIX.1\-2001 で規定されている。
\fBfdopendir\fP()  は
POSIX.1\-2008 で規定されている。
.\"O ----------------------------------------
.\"O .SH NOTES
.\"O Filename entries can be read from a directory stream using
.\"O .BR readdir (3).
.SH 注意
ファイル名エントリーをディレクトリストリームから読み込むには \fBreaddir\fP(3) を使用する。
.\"O ----------------------------------------
.\"O .PP
.\"O The underlying file descriptor of the directory stream can be
obtained using
.\"O .BR dirfd (3).
.PP
ディレクトリストリームに対応するファイルディスクリプターは \fBdirfd\fP(3) を使用して取得できる。
.\"O ----------------------------------------
.\"O .PP
.\"O The
.\"O .BR opendir ()
.\"O function sets the close-on-exec flag for the file descriptor underlying the
.\"O .IR "DIR *" .
.\"O The
.\"O .BR fdopendir ()
.\"O function leaves the setting of the close-on-exec
.\"O flag unchanged for the file descriptor,
.\"O .IR fd .
.\"O POSIX.1-200x leaves it unspecified whether a successful call to
.\"O .BR fdopendir ()
.\"O will set the close-on-exec flag for the file descriptor,
.\"O .IR fd .
.PP
\fBopendir\fP() 関数は、 \fIDIR *\fP の背後にあるファイルディスクリプターの close\-on\-exec フラグを設定する。
\fBfdopendir\fP() 関数は、ファイルディスクリプターの close\-on\-exec フラグの設定を変更しない。
\fBfdopendir\fP()
の呼び出しが成功した際に、ファイルディスクリプター \fIfd\fP の close\-on\-exec を設定するかどうかは、 POSIX.1\-200x
では規定されていない。
.\"O ----------------------------------------
.\"O .SH SEE ALSO
.\"O .BR open (2),
.\"O .BR closedir (3),
.\"O .BR dirfd (3),
.\"O .BR readdir (3),
.\"O .BR rewinddir (3),
.\"O .BR scandir (3),
.\"O .BR seekdir (3),
.\"O .BR telldir (3)
.SH 関連項目
\fBopen\fP(2), \fBclosedir\fP(3), \fBdirfd\fP(3), \fBreaddir\fP(3),
\fBrewinddir\fP(3),
\fBscandir\fP(3), \fBseekdir\fP(3), \fBtelldir\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 メーリングリストの案内
アーカイブの一覧に戻る