OSDN Git Service

58a41a4a268bc524aadfd2619ee99f9d53b9c433
[linuxjm/LDP_man-pages.git] / release / man3 / opendir.3
1 .\" Copyright (C) 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\"     386BSD man pages
29 .\" Modified Sat Jul 24 18:46:01 1993 by Rik Faith (faith@cs.unc.edu)
30 .\" Modified 11 June 1995 by Andries Brouwer (aeb@cwi.nl)
31 .\" 2007-07-30 Ulrich Drepper <drepper@redhat.com>: document fdopendir().
32 .\"*******************************************************************
33 .\"
34 .\" This file was generated with po4a. Translate the source file.
35 .\"
36 .\"*******************************************************************
37 .\"
38 .\" Japanese Version Copyright (c) 1997 Seiichi Yoshida
39 .\"       all rights reserved.
40 .\" Translated Fri Feb 14 14:53:20 JST 1997
41 .\"         by Seiichi Yoshida <seiichi@muraoka.info.waseda.ac.jp>
42 .\" Updated & Modified Thu Feb 17 00:37:46 JST 2005
43 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
44 .\"
45 .TH OPENDIR 3 2010\-06\-20 GNU "Linux Programmer's Manual"
46 .SH 名前
47 opendir, fdopendir \- ディレクトリをオープンする
48 .SH 書式
49 .nf
50 \fB#include <sys/types.h>\fP
51 .br
52 \fB#include <dirent.h>\fP
53 .sp
54 \fBDIR *opendir(const char *\fP\fIname\fP\fB);\fP
55 \fBDIR *fdopendir(int \fP\fIfd\fP\fB);\fP
56 .fi
57 .sp
58 .in -4n
59 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
60 .in
61 .sp
62 \fBfdopendir\fP():
63 .PD 0
64 .ad l
65 .RS 4
66 .TP  4
67 glibc 2.10 以降:
68 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
69 .TP 
70 glibc 2.10 より前:
71 _GNU_SOURCE
72 .RE
73 .ad
74 .PD
75 .SH 説明
76 \fBopendir\fP()  関数はディレクトリ \fIname\fP に対応する ディレクトリストリームをオープンし、そのストリームへのポインタを返す。
77 ストリームの位置はディレクトリの先頭のエントリに設定される。
78
79 \fBfdopendir\fP()  関数は \fBopendir\fP()  と同様だが、オープン済みのファイルディスクリプタ \fIfd\fP
80 により参照されるディレクトリに対する ディレクトリストリームを返す。 \fBfdopendir\fP()  の呼び出しが成功した後は、 \fIfd\fP
81 は実装の内部で使用される。アプリケーションは \fIfd\fP を他の場面で使用すべきではない。
82 .SH 返り値
83 関数 \fBopendir\fP()  と \fBfdopendir\fP()  はディレクトリストリームへのポインタを返す。 エラーの場合は、NULL
84 が返されて、 \fIerrno\fP が適切に設定される。
85 .SH エラー
86 .TP 
87 \fBEACCES\fP
88 アクセス権限がない。
89 .TP 
90 \fBEBADF\fP
91 \fIfd\fP が読み出し用にオープンされた、有効なファイルディスクリプタではない。
92 .TP 
93 \fBEMFILE\fP
94 プロセスが使用中のファイルディスクリプタが多すぎる。
95 .TP 
96 \fBENFILE\fP
97 システムでオープンされているファイルが多すぎる。
98 .TP 
99 \fBENOENT\fP
100 ディレクトリが存在しないか、または \fIname\fP が空文字列である。
101 .TP 
102 \fBENOMEM\fP
103 操作を完了するのに十分なメモリがない。
104 .TP 
105 \fBENOTDIR\fP
106 \fIname\fP はディレクトリではない。
107 .SH バージョン
108 \fBfdopendir\fP()  は glibc 2.4 以降で利用可能である。
109 .SH 準拠
110 \fBopendir\fP()  は SVr4 と 4.3BSD に存在し、 POSIX.1\-2001 で規定されている。 \fBfdopendir\fP()  は
111 POSIX.1\-2008 で規定されている。
112 .SH 注意
113 ディレクトリストリームに対応するファイルディスクリプタは \fBdirfd\fP(3)  を使用して得ることができる。
114
115 \fBopendir\fP()  関数は、 \fIDIR *\fP の背後にあるファイルディスクリプタの close\-on\-exec フラグを設定する。
116 \fBfdopendir\fP()  関数は、ファイルディスクリプタの close\-on\-exec フラグの設定を変更しない。 \fBfdopendir\fP()
117 の呼び出しが成功した際に、ファイルディスクリプタ \fIfd\fP の close\-on\-exec を設定するかどうかは、 POSIX.1\-200x
118 では規定されていない。
119 .SH 関連項目
120 \fBopen\fP(2), \fBclosedir\fP(3), \fBdirfd\fP(3), \fBreaddir\fP(3), \fBrewinddir\fP(3),
121 \fBscandir\fP(3), \fBseekdir\fP(3), \fBtelldir\fP(3)
122 .SH この文書について
123 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部
124 である。プロジェクトの説明とバグ報告に関する情報は
125 http://www.kernel.org/doc/man\-pages/ に書かれている。