OSDN Git Service

(split) LDP_man-pages: release ioctl.2 [JM:00378]
[linuxjm/LDP_man-pages.git] / draft / man3 / opendir.3
1 .\" Copyright (C) 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified Sat Jul 24 18:46:01 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified 11 June 1995 by Andries Brouwer (aeb@cwi.nl).
29 .\" 2007-07-30 Ulrich Drepper <drepper@redhat.com>: document fdopendir().
30 .\"
31 .\" Japanese Version Copyright (c) 1997 Seiichi Yoshida
32 .\"       all rights reserved.
33 .\" Translated Fri Feb 14 14:53:20 JST 1997
34 .\"         by Seiichi Yoshida <seiichi@muraoka.info.waseda.ac.jp>
35 .\" Updated & Modified Thu Feb 17 00:37:46 JST 2005
36 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
37 .\"
38 .\"WORD:    directory stream            ¥Ç¥£¥ì¥¯¥È¥ê¥¹¥È¥ê¡¼¥à
39 .\"WORD:    entry                       ¥¨¥ó¥È¥ê
40 .\"WORD:    Permission denied           ¥¢¥¯¥»¥¹¸¢¸Â¤¬¤Ê¤¤
41 .\"WORD:    file descriptor             ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
42 .\"
43 .TH OPENDIR 3  2010-06-20 "" "Linux Programmer's Manual"
44 .\"O .SH NAME
45 .SH Ì¾Á°
46 .\"O opendir, fdopendir \- open a directory
47 opendir, fdopendir \- ¥Ç¥£¥ì¥¯¥È¥ê¤ò¥ª¡¼¥×¥ó¤¹¤ë
48 .\"O .SH SYNOPSIS
49 .SH ½ñ¼°
50 .nf
51 .B #include <sys/types.h>
52 .br
53 .B #include <dirent.h>
54 .sp
55 .BI "DIR *opendir(const char *" name );
56 .BI "DIR *fdopendir(int " fd );
57 .fi
58 .sp
59 .in -4n
60 .\"O Feature Test Macro Requirements for glibc (see
61 .\"O .BR feature_test_macros (7)):
62 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
63 .RB ( feature_test_macros (7)
64 »²¾È):
65 .in
66 .sp
67 .BR fdopendir ():
68 .PD 0
69 .ad l
70 .RS 4
71 .TP 4
72 .\"O Since glibc 2.10:
73 glibc 2.10 °Ê¹ß:
74 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
75 .TP
76 .\"O Before glibc 2.10:
77 glibc 2.10 ¤è¤êÁ°:
78 _GNU_SOURCE
79 .RE
80 .ad
81 .PD
82 .\"O .SH DESCRIPTION
83 .SH ÀâÌÀ
84 .\"O The
85 .\"O .BR opendir ()
86 .\"O function opens a directory stream corresponding to the
87 .\"O directory \fIname\fP, and returns a pointer to the directory stream.
88 .\"O The stream is positioned at the first entry in the directory.
89 .BR opendir ()
90 ´Ø¿ô¤Ï¥Ç¥£¥ì¥¯¥È¥ê \fIname\fP ¤ËÂбþ¤¹¤ë
91 ¥Ç¥£¥ì¥¯¥È¥ê¥¹¥È¥ê¡¼¥à¤ò¥ª¡¼¥×¥ó¤·¡¢¤½¤Î¥¹¥È¥ê¡¼¥à¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
92 ¥¹¥È¥ê¡¼¥à¤Î°ÌÃ֤ϥǥ£¥ì¥¯¥È¥ê¤ÎÀèƬ¤Î¥¨¥ó¥È¥ê¤ËÀßÄꤵ¤ì¤ë¡£
93
94 .\"O The
95 .\"O .BR fdopendir ()
96 .\"O function
97 .\"O is like
98 .\"O .BR opendir (),
99 .\"O but returns a directory stream for the directory referred
100 .\"O to by the open file descriptor
101 .\"O .IR fd .
102 .\"O After a successful call to
103 .\"O .BR fdopendir (),
104 .\"O .I fd
105 .\"O is used internally by the implementation,
106 .\"O and should not otherwise be used by the application.
107 .BR fdopendir ()
108 ´Ø¿ô¤Ï
109 .BR opendir ()
110 ¤ÈƱÍͤÀ¤¬¡¢¥ª¡¼¥×¥óºÑ¤ß¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
111 .I fd
112 ¤Ë¤è¤ê»²¾È¤µ¤ì¤ë¥Ç¥£¥ì¥¯¥È¥ê¤ËÂФ¹¤ë
113 ¥Ç¥£¥ì¥¯¥È¥ê¥¹¥È¥ê¡¼¥à¤òÊÖ¤¹¡£
114 .BR fdopendir ()
115 ¤Î¸Æ¤Ó½Ð¤·¤¬À®¸ù¤·¤¿¸å¤Ï¡¢
116 .I fd
117 ¤Ï¼ÂÁõ¤ÎÆâÉô¤Ç»ÈÍѤµ¤ì¤ë¡£¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï
118 .I fd
119 ¤ò¾¤Î¾ìÌ̤ǻÈÍѤ¹¤Ù¤­¤Ç¤Ï¤Ê¤¤¡£
120 .\"O .SH "RETURN VALUE"
121 .SH ÊÖ¤êÃÍ
122 .\"O The
123 .\"O .BR opendir ()
124 .\"O and
125 .\"O .BR fdopendir ()
126 .\"O functions return a pointer to the directory stream.
127 .\"O On error, NULL is returned, and
128 .\"O .I errno
129 .\"O is set appropriately.
130 ´Ø¿ô
131 .BR opendir ()
132 ¤È
133 .BR fdopendir ()
134 ¤Ï¥Ç¥£¥ì¥¯¥È¥ê¥¹¥È¥ê¡¼¥à¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
135 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï¡¢NULL ¤¬ÊÖ¤µ¤ì¤Æ¡¢
136 .I errno
137 ¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¤ë¡£
138 .\"O .SH ERRORS
139 .SH ¥¨¥é¡¼
140 .TP
141 .B EACCES
142 .\"O Permission denied.
143 ¥¢¥¯¥»¥¹¸¢¸Â¤¬¤Ê¤¤¡£
144 .TP
145 .B EBADF
146 .\"O .I fd
147 .\"O is not a valid file descriptor opened for reading.
148 .I fd
149 ¤¬Æɤ߽Ф·ÍѤ˥ª¡¼¥×¥ó¤µ¤ì¤¿¡¢Í­¸ú¤Ê¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ï¤Ê¤¤¡£
150 .TP
151 .B EMFILE
152 .\"O Too many file descriptors in use by process.
153 ¥×¥í¥»¥¹¤¬»ÈÍÑÃæ¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬Â¿¤¹¤®¤ë¡£
154 .TP
155 .B ENFILE
156 .\"O Too many files are currently open in the system.
157 ¥·¥¹¥Æ¥à¤Ç¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤¬Â¿¤¹¤®¤ë¡£
158 .TP
159 .B ENOENT
160 .\"O Directory does not exist, or \fIname\fP is an empty string.
161 ¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Ê¤¤¤«¡¢¤Þ¤¿¤Ï \fIname\fP ¤¬¶õʸ»úÎó¤Ç¤¢¤ë¡£
162 .TP
163 .B ENOMEM
164 .\"O Insufficient memory to complete the operation.
165 Ì¿Îá¤ò¼Â¹Ô¤¹¤ë¤Î¤Ë½¼Ê¬¤Ê¥á¥â¥ê¤¬¤Ê¤¤¡£
166 .TP
167 .B ENOTDIR
168 .\"O \fIname\fP is not a directory.
169 \fIname\fP ¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ï¤Ê¤¤¡£
170 .\"O .SH VERSIONS
171 .SH ¥Ð¡¼¥¸¥ç¥ó
172 .\"O .BR fdopendir ()
173 .\"O is available in glibc since version 2.4.
174 .BR fdopendir ()
175 ¤Ï glibc 2.4 °Ê¹ß¤ÇÍøÍѲÄǽ¤Ç¤¢¤ë¡£
176 .\"O .SH "CONFORMING TO"
177 .SH ½àµò
178 .\"O .BR opendir ()
179 .\"O is present on SVr4, 4.3BSD, and specified in POSIX.1-2001.
180 .BR opendir ()
181 ¤Ï SVr4 ¤È 4.3BSD ¤Ë¸ºß¤·¡¢
182 POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
183 .\"O .BR fdopendir ()
184 .\"O is specified in POSIX.1-2008.
185 .BR fdopendir ()
186 ¤Ï POSIX.1-2008 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
187 .\"O .SH NOTES
188 .SH Ãí°Õ
189 .\"O The underlying file descriptor of the directory stream can be obtained using
190 .\"O .BR dirfd (3).
191 ¥Ç¥£¥ì¥¯¥È¥ê¥¹¥È¥ê¡¼¥à¤ËÂбþ¤¹¤ë¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï
192 .BR dirfd (3)
193 ¤ò»ÈÍѤ·¤ÆÆÀ¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
194
195 .\"O The
196 .\"O .BR opendir ()
197 .\"O function sets the close-on-exec flag for the file descriptor underlying the
198 .\"O .IR "DIR *" .
199 .\"O The
200 .\"O .BR fdopendir ()
201 .\"O function leaves the setting of the close-on-exec
202 .\"O flag unchanged for the file descriptor,
203 .\"O .IR fd .
204 .BR opendir ()
205 ´Ø¿ô¤Ï¡¢
206 .I "DIR *"
207 ¤ÎÇظå¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î close-on-exec ¥Õ¥é¥°¤òÀßÄꤹ¤ë¡£
208 .BR fdopendir ()
209 ´Ø¿ô¤Ï¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î close-on-exec ¥Õ¥é¥°¤ÎÀßÄê¤òÊѹ¹¤·¤Ê¤¤¡£
210 .\"O POSIX.1-200x leaves it unspecified whether a successful call to
211 .\"O .BR fdopendir ()
212 .\"O will set the close-on-exec flag for the file descriptor,
213 .\"O .IR fd .
214 .BR fdopendir ()
215 ¤Î¸Æ¤Ó½Ð¤·¤¬À®¸ù¤·¤¿ºÝ¤Ë¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
216 .I fd
217 ¤Î close-on-exec ¤òÀßÄꤹ¤ë¤«¤É¤¦¤«¤Ï¡¢
218 POSIX.1-200x ¤Ç¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
219 .\"O .SH "SEE ALSO"
220 .SH ´ØÏ¢¹àÌÜ
221 .BR open (2),
222 .BR closedir (3),
223 .BR dirfd (3),
224 .BR readdir (3),
225 .BR rewinddir (3),
226 .BR scandir (3),
227 .BR seekdir (3),
228 .BR telldir (3)