OSDN Git Service

(split) LDP_man-pages: release ioctl.2 [JM:00378]
[linuxjm/LDP_man-pages.git] / draft / man3 / readdir.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 16:09:49 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified 11 June 1995 by Andries Brouwer (aeb@cwi.nl)
29 .\" Modified 22 July 1996 by Andries Brouwer (aeb@cwi.nl)
30 .\" 2007-07-30 Ulrich Drepper <drepper@redhat.com>, mtk:
31 .\"     Rework discussion of nonstandard structure fields.
32 .\" 2008-09-11, mtk, Document readdir_r().
33 .\"
34 .\" Japanese Version Copyright (c) 1997 HIROFUMI Nishizuka
35 .\"     all rights reserved.
36 .\" Translated 1997-12-24, HIROFUMI Nishizuka <nishi@rpts.cl.nec.co.jp>
37 .\" Updated & Modified 2002-03-24, Yuichi SATO <ysato@h4.dion.ne.jp>
38 .\" Updated & Modified 2005-01-16, Yuichi SATO <ysato444@yahoo.co.jp>
39 .\" Updated & Modified 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
40 .\" Updated 2008-08-11, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.05
41 .\"
42 .TH READDIR 3  2010-09-10 "" "Linux Programmer's Manual"
43 .\"O .SH NAME
44 .SH Ì¾Á°
45 .\"O readdir, readdir_r \- read a directory
46 readdir, readdir_r \- ¥Ç¥£¥ì¥¯¥È¥ê¤òÆɤ߹þ¤à
47 .\"O .SH SYNOPSIS
48 .SH ½ñ¼°
49 .nf
50 .B #include <dirent.h>
51 .sp
52 .BI "struct dirent *readdir(DIR *" dirp );
53 .sp
54 .BI "int readdir_r(DIR *" dirp ", struct dirent *" entry \
55 ", struct dirent **" result );
56 .fi
57 .sp
58 .in -4n
59 .\"O Feature Test Macro Requirements for glibc (see
60 .\"O .BR feature_test_macros (7)):
61 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
62 .RB ( feature_test_macros (7)
63 »²¾È):
64 .ad l
65 .in
66 .sp
67 .BR readdir_r ():
68 .RS 4
69 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _BSD_SOURCE ||
70 _SVID_SOURCE || _POSIX_SOURCE
71 .RE
72 .ad b
73 .\"O .SH DESCRIPTION
74 .SH ÀâÌÀ
75 .\"O The
76 .\"O .BR readdir ()
77 .\"O function returns a pointer to a \fIdirent\fP structure
78 .\"O representing the next directory entry in the directory stream pointed
79 .\"O to by \fIdirp\fP.
80 .\"O It returns NULL on reaching the end of the directory stream or if
81 .\"O an error occurred.
82 .BR readdir ()
83 ´Ø¿ô¤Ï¡¢\fIdirp\fP ¤¬»Ø¤¹¥Ç¥£¥ì¥¯¥È¥ê¥¹¥È¥ê¡¼¥à¤ÎÃæ¤Ç¡¢
84 ¼¡¤Î¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤òɽ¤¹ \fIdirent\fP ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤òÊÖ¤¹¡£
85 ¥Ç¥£¥ì¥¯¥È¥ê¥¹¥È¥ê¡¼¥à¤ÎËöÈø¤Ë㤷¤¿¾ì¹ç¤ä¡¢
86 ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Ï¡¢ NULL ¤òÊÖ¤¹¡£
87 .PP
88 .\"O On Linux, the
89 .\"O .I dirent
90 .\"O structure is defined as follows:
91 Linux ¤Ç¤Ï
92 .I dirent
93 ¹½Â¤ÂΤϰʲ¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
94 .PP
95 .in +4n
96 .nf
97 struct dirent {
98 .\"O     ino_t          d_ino;       /* inode number */
99 .\"O     off_t          d_off;       /* offset to the next dirent */
100 .\"O     unsigned short d_reclen;    /* length of this record */
101 .\"O     unsigned char  d_type;      /* type of file; not supported
102 .\"O                                    by all file system types */
103 .\"O     char           d_name[256]; /* filename */
104     ino_t          d_ino;       /* inode ÈÖ¹æ */
105     off_t          d_off;       /* ¼¡¤Î dirent ¤Ø¤Î¥ª¥Õ¥»¥Ã¥È */
106     unsigned short d_reclen;    /* ¤³¤Î¥ì¥³¡¼¥É¤ÎŤµ */
107     unsigned char  d_type;      /* ¥Õ¥¡¥¤¥ë¼ïÊÌ¡£Á´¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à */
108                                    ¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤ */
109     char           d_name[256]; /* ¥Õ¥¡¥¤¥ë̾ */
110 };
111 .fi
112 .in
113 .PP
114 .\"O The only fields in the
115 .\"O .I dirent
116 .\"O structure that are mandated by POSIX.1 are:
117 .\"O .IR d_name [],
118 .\"O of unspecified size, with at most
119 .\"O .B NAME_MAX
120 .\"O characters preceding the terminating null byte;
121 .\"O and (as an XSI extension)
122 .\"O .IR d_ino .
123 .I dirent
124 ¹½Â¤ÂΤΥե£¡¼¥ë¥É¤Ç POSIX.1 ¤ÇÍ׵ᤵ¤ì¤Æ¤¤¤ë¤Î¤Ï¡¢
125 .IR d_name []
126 ¤È (XSI ³ÈÄ¥¤Ç¤Î)
127 .I d_ino
128 ¤À¤±¤Ç¤¢¤ë¡£
129 .IR d_name []
130 ¤Ï¤½¤ÎÂ礭¤µ¤âµ¬Äꤵ¤ì¤Æ¤ª¤é¤º¡¢
131 ¤³¤Î¥Õ¥£¡¼¥ë¥É¤Ë¤ÏºÇÂç¤Ç
132 .B NAME_MAX
133 ¸Ä¤Îʸ»ú¤È¡¢¤½¤ì¤Ë³¤¯½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤¬³ÊǼ¤µ¤ì¤ë¡£
134 .\"O The other fields are unstandardized, and not present on all systems;
135 .\"O see NOTES below for some further details.
136 ¾¤Î¥Õ¥£¡¼¥ë¥É¤ÏÈóɸ½à¤Ç¤¢¤ê¡¢Á´¤Æ¤Î¥·¥¹¥Æ¥à¤Ë¸ºß¤¹¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¡£
137 ¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï¡¢²¼µ­¤Î¡ÖÃí°Õ¡×¤ò»²¾È¤Î¤³¤È¡£
138 .PP
139 .\"O The data returned by
140 .\"O .BR readdir ()
141 .\"O may be overwritten by subsequent calls to
142 .\"O .BR readdir ()
143 .\"O for the same directory stream.
144 .BR readdir ()
145 ¤Ë¤è¤Ã¤ÆÊÖ¤µ¤ì¤ë¥Ç¡¼¥¿¤Ï¡¢¤½¤ì°Ê¹ß¤ÎƱ¤¸¥¹¥È¥ê¡¼¥à¤ËÂФ¹¤ë
146 .BR readdir ()
147 ¤Î¸Æ¤Ó½Ð¤·¤Ë¤è¤Ã¤Æ¾å½ñ¤­¤µ¤ì¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
148
149 .\"O The
150 .\"O .BR readdir_r ()
151 .\"O function is a reentrant version of
152 .\"O .BR readdir ().
153 .\"O It reads the next directory entry from the directory stream
154 .\"O .IR dirp ,
155 .\"O and returns it in the caller-allocated buffer pointed to by
156 .\"O .IR entry .
157 .\"O (See NOTES for information on allocating this buffer.)
158 .\"O A pointer to the returned item is placed in
159 .\"O .IR *result ;
160 .\"O if the end of the directory stream was encountered,
161 .\"O then NULL is instead returned in
162 .\"O .IR *result .
163 .BR readdir_r ()
164 ´Ø¿ô¤Ï
165 .BR readdir ()
166 ¤Î¥ê¥¨¥ó¥È¥é¥ó¥ÈÈǤǤ¢¤ë¡£
167 ¤³¤Î´Ø¿ô¤Ï¥Ç¥£¥ì¥¯¥È¥ê¥¹¥È¥ê¡¼¥à
168 .I dirp
169 ¤«¤é¼¡¤Î¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤òÆɤ߹þ¤ß¡¢
170 .I entry
171 ¤¬»Ø¤¹¸Æ¤Ó½Ð¤·¸µ¤¬³ä¤êÅö¤Æ¤¿¥Ð¥Ã¥Õ¥¡¤Ë¤½¤Î¥¨¥ó¥È¥ê¤ò³ÊǼ¤·¤ÆÊÖ¤¹
172 (¤³¤Î¥Ð¥Ã¥Õ¥¡¤Î³ä¤êÅö¤Æ¤Ë¤Ä¤¤¤Æ¤Ï¡ÖÃí°Õ¡×¤ÎÀá¤ò»²¾È¤Î¤³¤È)¡£
173 ÊÖ¤µ¤ì¤ë¥¨¥ó¥È¥ê¤Ø¤Î¥Ý¥¤¥ó¥¿¤¬
174 .I *result
175 ¤Ë³ÊǼ¤µ¤ì¤ë¡£¥Ç¥£¥ì¥¯¥È¥ê¥¹¥È¥ê¡¼¥à¤ÎËöÈø¤Ë㤷¤¿¾ì¹ç¤Ï¡¢
176 NULL ¤¬
177 .I *result
178 ¤Ë³ÊǼ¤µ¤ì¤ë¡£
179 .\"O .SH "RETURN VALUE"
180 .SH ÊÖ¤êÃÍ
181 .\"O On success,
182 .\"O .BR readdir ()
183 .\"O returns a pointer to a
184 .\"O .I dirent
185 .\"O structure.
186 .\"O (This structure may be statically allocated; do not attempt to
187 .\"O .BR free (3)
188 .\"O it.)
189 .\"O If the end of the directory stream is reached, NULL is returned and
190 .\"O .I errno
191 .\"O is not changed.
192 À®¸ù¤¹¤ë¤È¡¢
193 .BR readdir ()
194 ¤Ï
195 .I dirent
196 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤òÊÖ¤¹¡£
197 (¤³¤Î¹½Â¤ÂΤÏÀÅŪ¤Ë³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
198 ¤³¤Î¥Ý¥¤¥ó¥¿¤ò
199 .BR free (3)
200 ¤·¤è¤¦¤È¤·¤Ê¤¤¤³¤È¡£)
201 ¥Ç¥£¥ì¥¯¥È¥ê¥¹¥È¥ê¡¼¥à¤ÎËöÈø¤Ë㤷¤¿¾ì¹ç¤Ë¤Ï¡¢NULL ¤¬ÊÖ¤µ¤ì¡¢
202 .I errno
203 ¤ÏÊѲ½¤·¤Ê¤¤¡£
204 .\"O If an error occurs, NULL is returned and
205 .\"O .I errno
206 .\"O is set appropriately.
207 ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¡¢NULL ¤¬ÊÖ¤µ¤ì¡¢
208 .I errno
209 ¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¤ë¡£
210
211 .\"O The
212 .\"O .BR readdir_r ()
213 .\"O function returns 0 on success.
214 .\"O On error, it returns a positive error number (listed under ERRORS).
215 .\"O If the end of the directory stream is reached,
216 .\"O .BR readdir_r ()
217 .\"O returns 0, and returns NULL in
218 .\"O .IR *result .
219 À®¸ù¤¹¤ë¤È¡¢
220 .BR readdir_r ()
221 ´Ø¿ô¤Ï 0 ¤òÊÖ¤¹¡£
222 ¥¨¥é¡¼¤Î¾ì¹ç¡¢(¡Ö¥¨¥é¡¼¡×¤ÎÀá¤Î¥ê¥¹¥È¤ËºÜ¤Ã¤Æ¤¤¤ë) Àµ¤Î¥¨¥é¡¼ÈÖ¹æ¤òÊÖ¤¹¡£
223 ¥Ç¥£¥ì¥¯¥È¥ê¥¹¥È¥ê¡¼¥à¤ÎËöÈø¤Ë㤷¤¿¾ì¹ç¡¢
224 .BR readdir_r ()
225 ¤ÏÊÖ¤êÃͤȤ·¤Æ 0 ¤òÊÖ¤·¡¢
226 .I *result
227 ¤Ë NULL ¤ò³ÊǼ¤¹¤ë¡£
228 .\"O .SH ERRORS
229 .SH ¥¨¥é¡¼
230 .TP
231 .B EBADF
232 .\"O Invalid directory stream descriptor \fIdirp\fP.
233 ¥Ç¥£¥ì¥¯¥È¥ê¥¹¥È¥ê¡¼¥à¥Ç¥£¥¹¥¯¥ê¥×¥¿ \fIdirp\fP ¤¬Ìµ¸ú¡£
234 .\"O .SH "CONFORMING TO"
235 .SH ½àµò
236 SVr4, 4.3BSD, POSIX.1-2001.
237 .\"O .SH NOTES
238 .SH Ãí°Õ
239 .\"O Only the fields
240 .\"O .I d_name
241 .\"O and
242 .\"O .I d_ino
243 .\"O are specified in POSIX.1-2001.
244 .\"O The remaining fields are available on many, but not all systems.
245 .\"O Under glibc,
246 .\"O programs can check for the availability of the fields not defined
247 .\"O in POSIX.1 by testing whether the macros
248 .\"O .BR _DIRENT_HAVE_D_NAMLEN ,
249 .\"O .BR _DIRENT_HAVE_D_RECLEN ,
250 .\"O .BR _DIRENT_HAVE_D_OFF ,
251 .\"O or
252 .\"O .B _DIRENT_HAVE_D_TYPE
253 .\"O are defined.
254 ¥Õ¥£¡¼¥ë¥É
255 .I d_name
256 ¤È
257 .I d_ino
258 ¤À¤±¤¬ POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
259 »Ä¤ê¤Î¥Õ¥£¡¼¥ë¥É¤Ï¿¤¯¤Î¥·¥¹¥Æ¥à¤Ë¸ºß¤¹¤ë¤¬¡¢Á´¤Æ¤Î¥·¥¹¥Æ¥à¤Ë
260 ¸ºß¤¹¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¡£
261 glibc ¤Ç¤Ï¡¢¥×¥í¥°¥é¥à¤¬ POSIX.1 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤¥Õ¥£¡¼¥ë¥É¤¬
262 ÍøÍѤǤ­¤ë¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
263 ¥Á¥§¥Ã¥¯¤¹¤ë¤Ë¤Ï¡¢¥Þ¥¯¥í
264 .BR _DIRENT_HAVE_D_NAMLEN ,
265 .BR _DIRENT_HAVE_D_RECLEN ,
266 .BR _DIRENT_HAVE_D_OFF ,
267 .B _DIRENT_HAVE_D_TYPE
268 ¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤«¤ò¥Æ¥¹¥È¤¹¤ì¤Ð¤è¤¤¡£
269
270 .\"O Other than Linux, the
271 .\"O .I d_type
272 .\"O field is available mainly only on BSD systems.
273 .I d_type
274 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢Linux °Ê³°¤Ç¤Ï¡¢
275 ¼ç¤Ë BSD ·Ï¤Î¥·¥¹¥Æ¥à¤Ë¤À¤±Â¸ºß¤¹¤ë¡£
276 .\"O This field makes it possible to avoid the expense of calling
277 .\"O .BR lstat (2)
278 .\"O if further actions depend on the type of the file.
279 ¤³¤Î¥Õ¥£¡¼¥ë¥É¤ò»È¤¦¤È¡¢
280 ¤½¤Î¸å¤ÎÆ°ºî¤¬¥Õ¥¡¥¤¥ë¤Î¼ïÊ̤ˤè¤ê·è¤Þ¤ë¾ì¹ç¤Ë¡¢
281 .BR lstat (2)
282 ¤ò¸Æ¤Ó½Ð¤¹¥³¥¹¥È¤òÈò¤±¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
283 .\"O If the
284 .\"O .B _BSD_SOURCE
285 .\"O feature test macro is defined,
286 .\"O then glibc defines the following macro constants
287 .\"O for the value returned in
288 .\"O .IR d_type :
289 µ¡Ç½¸¡ºº¥Þ¥¯¥í
290 .B _BSD_SOURCE
291 ¤¬ÄêµÁ¤µ¤ì¤¿¾ì¹ç¡¢glibc ¤Ï
292 .I d_type
293 ¤ÇÊÖ¤µ¤ì¤ëÃͤȤ·¤Æ°Ê²¼¤Î¥Þ¥¯¥íÄê¿ô¤òÄêµÁ¤¹¤ë¡£
294 .TP 12
295 .B DT_BLK
296 .\"O This is a block device.
297 ¥Ö¥í¥Ã¥¯¡¦¥Ç¥Ð¥¤¥¹¤Ç¤¢¤ë¡£
298 .TP
299 .B DT_CHR
300 .\"O This is a character device.
301 ¥­¥ã¥é¥¯¥¿¡¦¥Ç¥Ð¥¤¥¹¤Ç¤¢¤ë¡£
302 .TP
303 .B DT_DIR
304 .\"O This is a directory.
305 ¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¢¤ë¡£
306 .TP
307 .B DT_FIFO
308 .\"O This is a named pipe (FIFO).
309 ̾Á°ÉÕ¤­¥Ñ¥¤¥× (FIFO) ¤Ç¤¢¤ë¡£
310 .TP
311 .B DT_LNK
312 .\"O This is a symbolic link.
313 ¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤Ç¤¢¤ë¡£
314 .TP
315 .B DT_REG
316 .\"O This is a regular file.
317 Ä̾ï¤Î¥Õ¥¡¥¤¥ë¤Ç¤¢¤ë¡£
318 .TP
319 .B DT_SOCK
320 .\"O This is a UNIX domain socket.
321 UNIX ¥É¥á¥¤¥ó¥½¥±¥Ã¥È¤Ç¤¢¤ë¡£
322 .TP
323 .B DT_UNKNOWN
324 .\"O The file type is unknown.
325 ¥Õ¥¡¥¤¥ë¥¿¥¤¥×¤¬ÉÔÌÀ¤Ç¤¢¤ë¡£
326 .\" The glibc manual says that on some systems this is the only
327 .\" value returned
328 .PP
329 .\"O If the file type could not be determined, the value
330 .\"O .B DT_UNKNOWN
331 .\"O is returned in
332 .\"O .IR d_type .
333 ¥Õ¥¡¥¤¥ë¼ïÊ̤ò·èÄê¤Ç¤­¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢
334 .I d_type
335 ¤Ë
336 .B DT_UNKNOWN
337 ¤¬Æþ¤ë¡£
338
339 .\"O Currently,
340 .\"O .\" kernel 2.6.27
341 .\"O .\" The same sentence is in readdir.2
342 .\"O only some file systems (among them: Btrfs, ext2, etx3, and ext4)
343 .\"O have full support returning the file type in
344 .\"O .IR d_type .
345 .\"O All applications must properly handle a return of
346 .\"O .BR DT_UNKNOWN .
347 ¸½ºß¤Î¤È¤³¤í¡¢
348 .\" ¥«¡¼¥Í¥ë 2.6.27
349 .\" Æ±¤¸ÀâÌÀʸ¤¬ readdir.2 ¤Ë¤â¤¢¤ë¡£
350 .I d_type
351 ¤Ç¥Õ¥¡¥¤¥ë¥¿¥¤¥×¤òÊÖ¤¹µ¡Ç½¤¬´°Á´¤Ë¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤Î¤Ï¡¢
352 ¤¤¤¯¤Ä¤«¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ë¤ª¤¤¤Æ¤Î¤ß¤Ç¤¢¤ë
353 (Btrfs, ext2, ext3, ext4 ¤Ï¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë)¡£
354 ¤É¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤â¡¢
355 .B DT_UNKNOWN
356 ¤¬ÊÖ¤µ¤ì¤¿ºÝ¤ËŬÀڤ˽èÍý¤Ç¤­¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
357
358 .\"O Since POSIX.1 does not specify the size of the
359 .\"O .I d_name
360 .\"O field, and other nonstandard fields may precede that field within the
361 .\"O .I dirent
362 .\"O structure, portable applications that use
363 .\"O .BR readdir_r ()
364 .\"O should allocate the buffer whose address is passed in
365 .\"O .IR entry
366 .\"O as follows:
367 POSIX.1 ¤Ç¤Ï
368 .I d_name
369 ¥Õ¥£¡¼¥ë¥É¤Î¥µ¥¤¥º¤Ïµ¬Äꤵ¤ì¤Æ¤ª¤é¤º¡¢
370 .I dirent
371 ¹½Â¤ÂΤÎ
372 .I d_name
373 ¤Î¸å¤í¤Ë¾¤ÎÈóɸ½à¤Î¥Õ¥£¡¼¥ë¥É¤¬¤¢¤ë¤«¤â¤·¤ì¤Ê¤¤¤Î¤Ç¡¢
374 °Ü¿¢À­¤¬É¬Íפʥ¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç
375 .BR readdir_r ()
376 ¤ò»È¤¦¾ì¹ç¤Ï
377 .I entry
378 ¤ËÅϤ¹¥Ð¥Ã¥Õ¥¡¤ò¼¡¤Î¤è¤¦¤Ë¤·¤Æ³ä¤êÅö¤Æ¤ë¤Ù¤­¤Ç¤¢¤ë¡£
379 .in +4n
380 .nf
381
382 len = offsetof(struct dirent, d_name) +
383           pathconf(dirpath, _PC_NAME_MAX) + 1
384 entryp = malloc(len);
385
386 .fi
387 .in
388 .\"O (POSIX.1 requires that
389 .\"O .I d_name
390 .\"O is the last field in a
391 .\"O .IR "struct dirent" .)
392 (POSIX.1 ¤Ç¤Ï
393 .I "struct dirent"
394 ¤ÎºÇ¸å¤Î¥Õ¥£¡¼¥ë¥É¤¬
395 .I d_name
396 ¤Ç¤¢¤ë¤³¤È¤òÍ׵ᤷ¤Æ¤¤¤ë¡£)
397 .\"O .SH "SEE ALSO"
398 .SH ´ØÏ¢¹àÌÜ
399 .BR getdents (2),
400 .BR read (2),
401 .BR closedir (3),
402 .BR dirfd (3),
403 .BR ftw (3),
404 .BR offsetof (3),
405 .BR opendir (3),
406 .BR rewinddir (3),
407 .BR scandir (3),
408 .BR seekdir (3),
409 .BR telldir (3)