OSDN Git Service

ac2f7e798d3a4f8c1f146e23ce526e7e9d645e4c
[linuxjm/LDP_man-pages.git] / po4a / dirent / po / dirent.pot
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2015-01-23 22:24+0900\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: build/C/man3/closedir.3:31
21 #, no-wrap
22 msgid "CLOSEDIR"
23 msgstr ""
24
25 #. type: TH
26 #: build/C/man3/closedir.3:31
27 #, no-wrap
28 msgid "2008-09-23"
29 msgstr ""
30
31 #. type: TH
32 #: build/C/man3/closedir.3:31 build/C/man3/dirfd.3:25 build/C/man2/getdents.2:30 build/C/man3/getdirentries.3:27 build/C/man3/opendir.3:32 build/C/man2/readdir.2:30 build/C/man3/readdir.3:36 build/C/man3/rewinddir.3:31 build/C/man3/scandir.3:62 build/C/man3/seekdir.3:31 build/C/man3/telldir.3:30
33 #, no-wrap
34 msgid "Linux Programmer's Manual"
35 msgstr ""
36
37 #. type: SH
38 #: build/C/man3/closedir.3:32 build/C/man3/dirfd.3:26 build/C/man2/getdents.2:31 build/C/man3/getdirentries.3:28 build/C/man3/opendir.3:33 build/C/man2/readdir.2:31 build/C/man3/readdir.3:37 build/C/man3/rewinddir.3:32 build/C/man3/scandir.3:63 build/C/man3/seekdir.3:32 build/C/man3/telldir.3:31
39 #, no-wrap
40 msgid "NAME"
41 msgstr ""
42
43 #. type: Plain text
44 #: build/C/man3/closedir.3:34
45 msgid "closedir - close a directory"
46 msgstr ""
47
48 #. type: SH
49 #: build/C/man3/closedir.3:34 build/C/man3/dirfd.3:28 build/C/man2/getdents.2:33 build/C/man3/getdirentries.3:30 build/C/man3/opendir.3:35 build/C/man2/readdir.2:33 build/C/man3/readdir.3:39 build/C/man3/rewinddir.3:34 build/C/man3/scandir.3:66 build/C/man3/seekdir.3:35 build/C/man3/telldir.3:33
50 #, no-wrap
51 msgid "SYNOPSIS"
52 msgstr ""
53
54 #. type: Plain text
55 #: build/C/man3/closedir.3:37 build/C/man3/opendir.3:38 build/C/man3/rewinddir.3:37
56 #, no-wrap
57 msgid "B<#include E<lt>sys/types.hE<gt>>\n"
58 msgstr ""
59
60 #. type: Plain text
61 #: build/C/man3/closedir.3:39 build/C/man3/opendir.3:40 build/C/man3/readdir.3:42 build/C/man3/rewinddir.3:39 build/C/man3/scandir.3:69 build/C/man3/seekdir.3:38 build/C/man3/telldir.3:36
62 #, no-wrap
63 msgid "B<#include E<lt>dirent.hE<gt>>\n"
64 msgstr ""
65
66 #. type: Plain text
67 #: build/C/man3/closedir.3:41
68 #, no-wrap
69 msgid "B<int closedir(DIR *>I<dirp>B<);>\n"
70 msgstr ""
71
72 #. type: SH
73 #: build/C/man3/closedir.3:42 build/C/man3/dirfd.3:54 build/C/man2/getdents.2:41 build/C/man3/getdirentries.3:43 build/C/man3/opendir.3:63 build/C/man2/readdir.2:42 build/C/man3/readdir.3:61 build/C/man3/rewinddir.3:42 build/C/man3/scandir.3:118 build/C/man3/seekdir.3:49 build/C/man3/telldir.3:47
74 #, no-wrap
75 msgid "DESCRIPTION"
76 msgstr ""
77
78 #. type: Plain text
79 #: build/C/man3/closedir.3:55
80 msgid ""
81 "The B<closedir>()  function closes the directory stream associated with "
82 "I<dirp>.  A successful call to B<closedir>()  also closes the underlying "
83 "file descriptor associated with I<dirp>.  The directory stream descriptor "
84 "I<dirp> is not available after this call."
85 msgstr ""
86
87 #. type: SH
88 #: build/C/man3/closedir.3:55 build/C/man3/dirfd.3:69 build/C/man2/getdents.2:142 build/C/man3/getdirentries.3:56 build/C/man3/opendir.3:83 build/C/man2/readdir.2:91 build/C/man3/readdir.3:119 build/C/man3/rewinddir.3:49 build/C/man3/scandir.3:184 build/C/man3/seekdir.3:60 build/C/man3/telldir.3:52
89 #, no-wrap
90 msgid "RETURN VALUE"
91 msgstr ""
92
93 #. type: Plain text
94 #: build/C/man3/closedir.3:62
95 msgid ""
96 "The B<closedir>()  function returns 0 on success.  On error, -1 is returned, "
97 "and I<errno> is set appropriately."
98 msgstr ""
99
100 #. type: SH
101 #: build/C/man3/closedir.3:62 build/C/man3/dirfd.3:74 build/C/man2/getdents.2:148 build/C/man3/getdirentries.3:62 build/C/man3/opendir.3:92 build/C/man2/readdir.2:97 build/C/man3/readdir.3:143 build/C/man3/scandir.3:200 build/C/man3/telldir.3:60
102 #, no-wrap
103 msgid "ERRORS"
104 msgstr ""
105
106 #. type: TP
107 #: build/C/man3/closedir.3:63 build/C/man2/getdents.2:149 build/C/man3/opendir.3:96 build/C/man2/readdir.2:98 build/C/man3/readdir.3:144 build/C/man3/scandir.3:213 build/C/man3/telldir.3:61
108 #, no-wrap
109 msgid "B<EBADF>"
110 msgstr ""
111
112 #. type: Plain text
113 #: build/C/man3/closedir.3:67 build/C/man3/readdir.3:147 build/C/man3/telldir.3:64
114 msgid "Invalid directory stream descriptor I<dirp>."
115 msgstr ""
116
117 #. type: SH
118 #: build/C/man3/closedir.3:67 build/C/man3/dirfd.3:92 build/C/man2/getdents.2:165 build/C/man3/getdirentries.3:69 build/C/man3/opendir.3:118 build/C/man2/readdir.2:114 build/C/man3/readdir.3:156 build/C/man3/rewinddir.3:58 build/C/man3/scandir.3:229 build/C/man3/seekdir.3:69 build/C/man3/telldir.3:69
119 #, no-wrap
120 msgid "CONFORMING TO"
121 msgstr ""
122
123 #. type: Plain text
124 #: build/C/man3/closedir.3:69
125 msgid "SVr4, POSIX.1-2001, 4.3BSD."
126 msgstr ""
127
128 #. type: SH
129 #: build/C/man3/closedir.3:69 build/C/man3/dirfd.3:104 build/C/man2/getdents.2:282 build/C/man3/getdirentries.3:77 build/C/man3/opendir.3:140 build/C/man2/readdir.2:127 build/C/man3/readdir.3:265 build/C/man3/rewinddir.3:60 build/C/man3/scandir.3:283 build/C/man3/seekdir.3:83 build/C/man3/telldir.3:95
130 #, no-wrap
131 msgid "SEE ALSO"
132 msgstr ""
133
134 #. type: Plain text
135 #: build/C/man3/closedir.3:77
136 msgid ""
137 "B<close>(2), B<opendir>(3), B<readdir>(3), B<rewinddir>(3), B<scandir>(3), "
138 "B<seekdir>(3), B<telldir>(3)"
139 msgstr ""
140
141 #. type: SH
142 #: build/C/man3/closedir.3:77 build/C/man3/dirfd.3:113 build/C/man2/getdents.2:285 build/C/man3/getdirentries.3:80 build/C/man3/opendir.3:149 build/C/man2/readdir.2:130 build/C/man3/readdir.3:277 build/C/man3/rewinddir.3:67 build/C/man3/scandir.3:294 build/C/man3/seekdir.3:91 build/C/man3/telldir.3:102
143 #, no-wrap
144 msgid "COLOPHON"
145 msgstr ""
146
147 #. type: Plain text
148 #: build/C/man3/closedir.3:85 build/C/man3/dirfd.3:121 build/C/man2/getdents.2:293 build/C/man3/getdirentries.3:88 build/C/man3/opendir.3:157 build/C/man2/readdir.2:138 build/C/man3/readdir.3:285 build/C/man3/rewinddir.3:75 build/C/man3/scandir.3:302 build/C/man3/seekdir.3:99 build/C/man3/telldir.3:110
149 msgid ""
150 "This page is part of release 3.78 of the Linux I<man-pages> project.  A "
151 "description of the project, information about reporting bugs, and the latest "
152 "version of this page, can be found at "
153 "\\%http://www.kernel.org/doc/man-pages/."
154 msgstr ""
155
156 #. type: TH
157 #: build/C/man3/dirfd.3:25
158 #, no-wrap
159 msgid "DIRFD"
160 msgstr ""
161
162 #. type: TH
163 #: build/C/man3/dirfd.3:25
164 #, no-wrap
165 msgid "2013-07-05"
166 msgstr ""
167
168 #. type: TH
169 #: build/C/man3/dirfd.3:25 build/C/man2/getdents.2:30 build/C/man2/readdir.2:30
170 #, no-wrap
171 msgid "Linux"
172 msgstr ""
173
174 #. type: Plain text
175 #: build/C/man3/dirfd.3:28
176 msgid "dirfd - get directory stream file descriptor"
177 msgstr ""
178
179 #. type: Plain text
180 #: build/C/man3/dirfd.3:30
181 msgid "B<#include E<lt>sys/types.hE<gt>>"
182 msgstr ""
183
184 #. type: Plain text
185 #: build/C/man3/dirfd.3:32 build/C/man3/getdirentries.3:32
186 msgid "B<#include E<lt>dirent.hE<gt>>"
187 msgstr ""
188
189 #. type: Plain text
190 #: build/C/man3/dirfd.3:34
191 msgid "B<int dirfd(DIR *>I<dirp>B<);>"
192 msgstr ""
193
194 #. type: Plain text
195 #: build/C/man3/dirfd.3:38 build/C/man3/getdirentries.3:39 build/C/man3/opendir.3:48 build/C/man3/readdir.3:52 build/C/man3/scandir.3:96 build/C/man3/seekdir.3:45 build/C/man3/telldir.3:43
196 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
197 msgstr ""
198
199 #. type: Plain text
200 #: build/C/man3/dirfd.3:41
201 msgid "B<dirfd>():"
202 msgstr ""
203
204 #. type: Plain text
205 #: build/C/man3/dirfd.3:46 build/C/man3/scandir.3:105
206 msgid "_BSD_SOURCE || _SVID_SOURCE"
207 msgstr ""
208
209 #. type: Plain text
210 #: build/C/man3/dirfd.3:48 build/C/man3/scandir.3:107
211 msgid "|| /* Since glibc 2.10: */"
212 msgstr ""
213
214 #. type: Plain text
215 #: build/C/man3/dirfd.3:50 build/C/man3/scandir.3:109
216 msgid "(_POSIX_C_SOURCE\\ E<gt>=\\ 200809L || _XOPEN_SOURCE\\ E<gt>=\\ 700)"
217 msgstr ""
218
219 #. type: Plain text
220 #: build/C/man3/dirfd.3:59
221 msgid ""
222 "The function B<dirfd>()  returns the file descriptor associated with the "
223 "directory stream I<dirp>."
224 msgstr ""
225
226 #. type: Plain text
227 #: build/C/man3/dirfd.3:69
228 msgid ""
229 "This descriptor is the one used internally by the directory stream.  As a "
230 "result, it is useful only for functions which do not depend on or alter the "
231 "file position, such as B<fstat>(2)  and B<fchdir>(2).  It will be "
232 "automatically closed when B<closedir>(3)  is called."
233 msgstr ""
234
235 #. type: Plain text
236 #: build/C/man3/dirfd.3:74
237 msgid ""
238 "On success, a nonnegative file descriptor is returned.  On error, -1 is "
239 "returned, and I<errno> is set to indicate the cause of the error."
240 msgstr ""
241
242 #.  glibc 2.8
243 #. type: Plain text
244 #: build/C/man3/dirfd.3:79
245 msgid ""
246 "POSIX.1-2008 specifies two errors, neither of which is returned by the "
247 "current implementation."
248 msgstr ""
249
250 #. type: TP
251 #: build/C/man3/dirfd.3:79 build/C/man2/getdents.2:156 build/C/man2/readdir.2:105
252 #, no-wrap
253 msgid "B<EINVAL>"
254 msgstr ""
255
256 #. type: Plain text
257 #: build/C/man3/dirfd.3:83
258 msgid "I<dirp> does not refer to a valid directory stream."
259 msgstr ""
260
261 #. type: TP
262 #: build/C/man3/dirfd.3:83
263 #, no-wrap
264 msgid "B<ENOTSUP>"
265 msgstr ""
266
267 #. type: Plain text
268 #: build/C/man3/dirfd.3:87
269 msgid ""
270 "The implementation does not support the association of a file descriptor "
271 "with a directory."
272 msgstr ""
273
274 #. type: SH
275 #: build/C/man3/dirfd.3:87 build/C/man3/getdirentries.3:64 build/C/man3/readdir.3:147 build/C/man3/rewinddir.3:53 build/C/man3/seekdir.3:64 build/C/man3/telldir.3:64
276 #, no-wrap
277 msgid "ATTRIBUTES"
278 msgstr ""
279
280 #. type: SS
281 #: build/C/man3/dirfd.3:88 build/C/man3/getdirentries.3:65 build/C/man3/readdir.3:148 build/C/man3/rewinddir.3:54 build/C/man3/seekdir.3:65 build/C/man3/telldir.3:65
282 #, no-wrap
283 msgid "Multithreading (see pthreads(7))"
284 msgstr ""
285
286 #. type: Plain text
287 #: build/C/man3/dirfd.3:92
288 msgid "The B<dirfd>()  function is thread-safe."
289 msgstr ""
290
291 #.  It is present in libc5 (since 5.1.2) and in glibc2.
292 #. type: Plain text
293 #: build/C/man3/dirfd.3:96
294 msgid ""
295 "POSIX.1-2008.  This function was a BSD extension, present in 4.3BSD-Reno, "
296 "not in 4.2BSD."
297 msgstr ""
298
299 #. type: SH
300 #: build/C/man3/dirfd.3:96 build/C/man2/getdents.2:168 build/C/man3/opendir.3:123 build/C/man2/readdir.2:116 build/C/man3/readdir.3:158 build/C/man3/scandir.3:252 build/C/man3/seekdir.3:71 build/C/man3/telldir.3:71
301 #, no-wrap
302 msgid "NOTES"
303 msgstr ""
304
305 #. type: Plain text
306 #: build/C/man3/dirfd.3:104
307 msgid ""
308 "The prototype for B<dirfd>()  is available only if B<_BSD_SOURCE> or "
309 "B<_SVID_SOURCE> is defined."
310 msgstr ""
311
312 #. type: Plain text
313 #: build/C/man3/dirfd.3:113
314 msgid ""
315 "B<open>(2), B<closedir>(3), B<opendir>(3), B<readdir>(3), B<rewinddir>(3), "
316 "B<scandir>(3), B<seekdir>(3), B<telldir>(3)"
317 msgstr ""
318
319 #. type: TH
320 #: build/C/man2/getdents.2:30
321 #, no-wrap
322 msgid "GETDENTS"
323 msgstr ""
324
325 #. type: TH
326 #: build/C/man2/getdents.2:30
327 #, no-wrap
328 msgid "2012-08-03"
329 msgstr ""
330
331 #. type: Plain text
332 #: build/C/man2/getdents.2:33
333 msgid "getdents - get directory entries"
334 msgstr ""
335
336 #. type: Plain text
337 #: build/C/man2/getdents.2:37
338 #, no-wrap
339 msgid ""
340 "B<int getdents(unsigned int >I<fd>B<, struct linux_dirent *>I<dirp>B<,>\n"
341 "B<             unsigned int >I<count>B<);>\n"
342 msgstr ""
343
344 #. type: Plain text
345 #: build/C/man2/getdents.2:41 build/C/man2/readdir.2:42
346 msgid "I<Note>: There is no glibc wrapper for this system call; see NOTES."
347 msgstr ""
348
349 #. type: Plain text
350 #: build/C/man2/getdents.2:47
351 msgid ""
352 "This is not the function you are interested in.  Look at B<readdir>(3)  for "
353 "the POSIX conforming C library interface.  This page documents the bare "
354 "kernel system call interface."
355 msgstr ""
356
357 #. type: Plain text
358 #: build/C/man2/getdents.2:60
359 msgid ""
360 "The system call B<getdents>()  reads several I<linux_dirent> structures from "
361 "the directory referred to by the open file descriptor I<fd> into the buffer "
362 "pointed to by I<dirp>.  The argument I<count> specifies the size of that "
363 "buffer."
364 msgstr ""
365
366 #. type: Plain text
367 #: build/C/man2/getdents.2:64
368 msgid "The I<linux_dirent> structure is declared as follows:"
369 msgstr ""
370
371 #. type: Plain text
372 #: build/C/man2/getdents.2:79
373 #, no-wrap
374 msgid ""
375 "struct linux_dirent {\n"
376 "    unsigned long  d_ino;     /* Inode number */\n"
377 "    unsigned long  d_off;     /* Offset to next I<linux_dirent> */\n"
378 "    unsigned short d_reclen;  /* Length of this I<linux_dirent> */\n"
379 "    char           d_name[];  /* Filename (null-terminated) */\n"
380 "                      /* length is actually (d_reclen - 2 -\n"
381 "                         offsetof(struct linux_dirent, d_name)) */\n"
382 "    /*\n"
383 "    char           pad;       // Zero padding byte\n"
384 "    char           d_type;    // File type (only since Linux\n"
385 "                              // 2.6.4); offset is (d_reclen - 1)\n"
386 "    */\n"
387 msgstr ""
388
389 #. type: Plain text
390 #: build/C/man2/getdents.2:81
391 #, no-wrap
392 msgid "}\n"
393 msgstr ""
394
395 #. type: Plain text
396 #: build/C/man2/getdents.2:94
397 msgid ""
398 "I<d_ino> is an inode number.  I<d_off> is the distance from the start of the "
399 "directory to the start of the next I<linux_dirent>.  I<d_reclen> is the size "
400 "of this entire I<linux_dirent>.  I<d_name> is a null-terminated filename."
401 msgstr ""
402
403 #. type: Plain text
404 #: build/C/man2/getdents.2:99
405 msgid ""
406 "I<d_type> is a byte at the end of the structure that indicates the file "
407 "type.  It contains one of the following values (defined in "
408 "I<E<lt>dirent.hE<gt>>):"
409 msgstr ""
410
411 #. type: TP
412 #: build/C/man2/getdents.2:99 build/C/man3/readdir.3:200
413 #, no-wrap
414 msgid "B<DT_BLK>"
415 msgstr ""
416
417 #. type: Plain text
418 #: build/C/man2/getdents.2:102 build/C/man3/readdir.3:203
419 msgid "This is a block device."
420 msgstr ""
421
422 #. type: TP
423 #: build/C/man2/getdents.2:102 build/C/man3/readdir.3:203
424 #, no-wrap
425 msgid "B<DT_CHR>"
426 msgstr ""
427
428 #. type: Plain text
429 #: build/C/man2/getdents.2:105 build/C/man3/readdir.3:206
430 msgid "This is a character device."
431 msgstr ""
432
433 #. type: TP
434 #: build/C/man2/getdents.2:105 build/C/man3/readdir.3:206
435 #, no-wrap
436 msgid "B<DT_DIR>"
437 msgstr ""
438
439 #. type: Plain text
440 #: build/C/man2/getdents.2:108 build/C/man3/readdir.3:209
441 msgid "This is a directory."
442 msgstr ""
443
444 #. type: TP
445 #: build/C/man2/getdents.2:108 build/C/man3/readdir.3:209
446 #, no-wrap
447 msgid "B<DT_FIFO>"
448 msgstr ""
449
450 #. type: Plain text
451 #: build/C/man2/getdents.2:111 build/C/man3/readdir.3:212
452 msgid "This is a named pipe (FIFO)."
453 msgstr ""
454
455 #. type: TP
456 #: build/C/man2/getdents.2:111 build/C/man3/readdir.3:212
457 #, no-wrap
458 msgid "B<DT_LNK>"
459 msgstr ""
460
461 #. type: Plain text
462 #: build/C/man2/getdents.2:114 build/C/man3/readdir.3:215
463 msgid "This is a symbolic link."
464 msgstr ""
465
466 #. type: TP
467 #: build/C/man2/getdents.2:114 build/C/man3/readdir.3:215
468 #, no-wrap
469 msgid "B<DT_REG>"
470 msgstr ""
471
472 #. type: Plain text
473 #: build/C/man2/getdents.2:117 build/C/man3/readdir.3:218
474 msgid "This is a regular file."
475 msgstr ""
476
477 #. type: TP
478 #: build/C/man2/getdents.2:117 build/C/man3/readdir.3:218
479 #, no-wrap
480 msgid "B<DT_SOCK>"
481 msgstr ""
482
483 #. type: Plain text
484 #: build/C/man2/getdents.2:120 build/C/man3/readdir.3:221
485 msgid "This is a UNIX domain socket."
486 msgstr ""
487
488 #. type: TP
489 #: build/C/man2/getdents.2:120 build/C/man3/readdir.3:221
490 #, no-wrap
491 msgid "B<DT_UNKNOWN>"
492 msgstr ""
493
494 #.  The glibc manual says that on some systems this is the only
495 #.  value returned
496 #. type: Plain text
497 #: build/C/man2/getdents.2:123 build/C/man3/readdir.3:226
498 msgid "The file type is unknown."
499 msgstr ""
500
501 #. type: Plain text
502 #: build/C/man2/getdents.2:133
503 msgid ""
504 "The I<d_type> field is implemented since Linux 2.6.4.  It occupies a space "
505 "that was previously a zero-filled padding byte in the I<linux_dirent> "
506 "structure.  Thus, on kernels before 2.6.3, attempting to access this field "
507 "always provides the value 0 (B<DT_UNKNOWN>)."
508 msgstr ""
509
510 #.  kernel 2.6.27
511 #.  The same sentence is in getdents.2
512 #. type: Plain text
513 #: build/C/man2/getdents.2:142 build/C/man3/readdir.3:240
514 msgid ""
515 "Currently, only some filesystems (among them: Btrfs, ext2, ext3, and ext4)  "
516 "have full support for returning the file type in I<d_type>.  All "
517 "applications must properly handle a return of B<DT_UNKNOWN>."
518 msgstr ""
519
520 #. type: Plain text
521 #: build/C/man2/getdents.2:148
522 msgid ""
523 "On success, the number of bytes read is returned.  On end of directory, 0 is "
524 "returned.  On error, -1 is returned, and I<errno> is set appropriately."
525 msgstr ""
526
527 #. type: Plain text
528 #: build/C/man2/getdents.2:153 build/C/man2/readdir.2:102
529 msgid "Invalid file descriptor I<fd>."
530 msgstr ""
531
532 #. type: TP
533 #: build/C/man2/getdents.2:153 build/C/man2/readdir.2:102
534 #, no-wrap
535 msgid "B<EFAULT>"
536 msgstr ""
537
538 #. type: Plain text
539 #: build/C/man2/getdents.2:156 build/C/man2/readdir.2:105
540 msgid "Argument points outside the calling process's address space."
541 msgstr ""
542
543 #. type: Plain text
544 #: build/C/man2/getdents.2:159 build/C/man2/readdir.2:108
545 msgid "Result buffer is too small."
546 msgstr ""
547
548 #. type: TP
549 #: build/C/man2/getdents.2:159 build/C/man3/opendir.3:106 build/C/man2/readdir.2:108 build/C/man3/scandir.3:201
550 #, no-wrap
551 msgid "B<ENOENT>"
552 msgstr ""
553
554 #. type: Plain text
555 #: build/C/man2/getdents.2:162 build/C/man2/readdir.2:111
556 msgid "No such directory."
557 msgstr ""
558
559 #. type: TP
560 #: build/C/man2/getdents.2:162 build/C/man3/opendir.3:112 build/C/man2/readdir.2:111 build/C/man3/scandir.3:207 build/C/man3/scandir.3:217
561 #, no-wrap
562 msgid "B<ENOTDIR>"
563 msgstr ""
564
565 #. type: Plain text
566 #: build/C/man2/getdents.2:165 build/C/man2/readdir.2:114
567 msgid "File descriptor does not refer to a directory."
568 msgstr ""
569
570 #.  SVr4 documents additional ENOLINK, EIO error conditions.
571 #. type: Plain text
572 #: build/C/man2/getdents.2:168
573 msgid "SVr4."
574 msgstr ""
575
576 #. type: Plain text
577 #: build/C/man2/getdents.2:177
578 msgid ""
579 "Glibc does not provide a wrapper for this system call; call it using "
580 "B<syscall>(2).  You will need to define the I<linux_dirent> structure "
581 "yourself.  However, you probably want to use B<readdir>(3)  instead."
582 msgstr ""
583
584 #. type: Plain text
585 #: build/C/man2/getdents.2:180
586 msgid "This call supersedes B<readdir>(2)."
587 msgstr ""
588
589 #. type: Plain text
590 #: build/C/man2/getdents.2:193
591 msgid ""
592 "The original Linux B<getdents>()  system call did not handle large "
593 "filesystems and large file offsets.  Consequently, Linux 2.4 added "
594 "B<getdents64>(), with wider types for the I<d_ino> and I<d_off> fields "
595 "employed in the I<linux_dirent> structure."
596 msgstr ""
597
598 #. type: SH
599 #: build/C/man2/getdents.2:193 build/C/man3/scandir.3:259
600 #, no-wrap
601 msgid "EXAMPLE"
602 msgstr ""
603
604 #.  FIXME The example program needs to be revised, since it uses the older
605 #.  getdents() system call and the structure with smaller field widths.
606 #. type: Plain text
607 #: build/C/man2/getdents.2:200
608 msgid ""
609 "The program below demonstrates the use of B<getdents>().  The following "
610 "output shows an example of what we see when running this program on an ext2 "
611 "directory:"
612 msgstr ""
613
614 #. type: Plain text
615 #: build/C/man2/getdents.2:213
616 #, no-wrap
617 msgid ""
618 "$B< ./a.out /testfs/>\n"
619 "--------------- nread=120 ---------------\n"
620 "inode#    file type  d_reclen  d_off   d_name\n"
621 "       2  directory    16         12  .\n"
622 "       2  directory    16         24  ..\n"
623 "      11  directory    24         44  lost+found\n"
624 "      12  regular      16         56  a\n"
625 "  228929  directory    16         68  sub\n"
626 "   16353  directory    16         80  sub2\n"
627 "  130817  directory    16       4096  sub3\n"
628 msgstr ""
629
630 #. type: SS
631 #: build/C/man2/getdents.2:215
632 #, no-wrap
633 msgid "Program source"
634 msgstr ""
635
636 #. type: Plain text
637 #: build/C/man2/getdents.2:226
638 #, no-wrap
639 msgid ""
640 "#define _GNU_SOURCE\n"
641 "#include E<lt>dirent.hE<gt>     /* Defines DT_* constants */\n"
642 "#include E<lt>fcntl.hE<gt>\n"
643 "#include E<lt>stdio.hE<gt>\n"
644 "#include E<lt>unistd.hE<gt>\n"
645 "#include E<lt>stdlib.hE<gt>\n"
646 "#include E<lt>sys/stat.hE<gt>\n"
647 "#include E<lt>sys/syscall.hE<gt>\n"
648 msgstr ""
649
650 #. type: Plain text
651 #: build/C/man2/getdents.2:229
652 #, no-wrap
653 msgid ""
654 "#define handle_error(msg) \\e\n"
655 "        do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
656 msgstr ""
657
658 #. type: Plain text
659 #: build/C/man2/getdents.2:236
660 #, no-wrap
661 msgid ""
662 "struct linux_dirent {\n"
663 "    long           d_ino;\n"
664 "    off_t          d_off;\n"
665 "    unsigned short d_reclen;\n"
666 "    char           d_name[];\n"
667 "};\n"
668 msgstr ""
669
670 #. type: Plain text
671 #: build/C/man2/getdents.2:238
672 #, no-wrap
673 msgid "#define BUF_SIZE 1024\n"
674 msgstr ""
675
676 #. type: Plain text
677 #: build/C/man2/getdents.2:247
678 #, no-wrap
679 msgid ""
680 "int\n"
681 "main(int argc, char *argv[])\n"
682 "{\n"
683 "    int fd, nread;\n"
684 "    char buf[BUF_SIZE];\n"
685 "    struct linux_dirent *d;\n"
686 "    int bpos;\n"
687 "    char d_type;\n"
688 msgstr ""
689
690 #. type: Plain text
691 #: build/C/man2/getdents.2:251
692 #, no-wrap
693 msgid ""
694 "    fd = open(argc E<gt> 1 ? argv[1] : \".\", O_RDONLY | O_DIRECTORY);\n"
695 "    if (fd == -1)\n"
696 "        handle_error(\"open\");\n"
697 msgstr ""
698
699 #. type: Plain text
700 #: build/C/man2/getdents.2:256
701 #, no-wrap
702 msgid ""
703 "    for ( ; ; ) {\n"
704 "        nread = syscall(SYS_getdents, fd, buf, BUF_SIZE);\n"
705 "        if (nread == -1)\n"
706 "            handle_error(\"getdents\");\n"
707 msgstr ""
708
709 #. type: Plain text
710 #: build/C/man2/getdents.2:259
711 #, no-wrap
712 msgid ""
713 "        if (nread == 0)\n"
714 "            break;\n"
715 msgstr ""
716
717 #. type: Plain text
718 #: build/C/man2/getdents.2:278
719 #, no-wrap
720 msgid ""
721 "        printf(\"--------------- nread=%d ---------------\\en\", nread);\n"
722 "        printf(\"inode#    file type  d_reclen  d_off   d_name\\en\");\n"
723 "        for (bpos = 0; bpos E<lt> nread;) {\n"
724 "            d = (struct linux_dirent *) (buf + bpos);\n"
725 "            printf(\"%8ld  \", d-E<gt>d_ino);\n"
726 "            d_type = *(buf + bpos + d-E<gt>d_reclen - 1);\n"
727 "            printf(\"%-10s \", (d_type == DT_REG) ?  \"regular\" :\n"
728 "                             (d_type == DT_DIR) ?  \"directory\" :\n"
729 "                             (d_type == DT_FIFO) ? \"FIFO\" :\n"
730 "                             (d_type == DT_SOCK) ? \"socket\" :\n"
731 "                             (d_type == DT_LNK) ?  \"symlink\" :\n"
732 "                             (d_type == DT_BLK) ?  \"block dev\" :\n"
733 "                             (d_type == DT_CHR) ?  \"char dev\" : "
734 "\"???\");\n"
735 "            printf(\"%4d %10lld  %s\\en\", d-E<gt>d_reclen,\n"
736 "                    (long long) d-E<gt>d_off, d-E<gt>d_name);\n"
737 "            bpos += d-E<gt>d_reclen;\n"
738 "        }\n"
739 "    }\n"
740 msgstr ""
741
742 #. type: Plain text
743 #: build/C/man2/getdents.2:281
744 #, no-wrap
745 msgid ""
746 "    exit(EXIT_SUCCESS);\n"
747 "}\n"
748 msgstr ""
749
750 #. type: Plain text
751 #: build/C/man2/getdents.2:285
752 msgid "B<readdir>(2), B<readdir>(3)"
753 msgstr ""
754
755 #. type: TH
756 #: build/C/man3/getdirentries.3:27
757 #, no-wrap
758 msgid "GETDIRENTRIES"
759 msgstr ""
760
761 #. type: TH
762 #: build/C/man3/getdirentries.3:27
763 #, no-wrap
764 msgid "2014-06-13"
765 msgstr ""
766
767 #. type: TH
768 #: build/C/man3/getdirentries.3:27 build/C/man3/opendir.3:32 build/C/man3/scandir.3:62
769 #, no-wrap
770 msgid "GNU"
771 msgstr ""
772
773 #. type: Plain text
774 #: build/C/man3/getdirentries.3:30
775 msgid "getdirentries - get directory entries in a filesystem-independent format"
776 msgstr ""
777
778 #. type: Plain text
779 #: build/C/man3/getdirentries.3:35
780 msgid ""
781 "B<ssize_t getdirentries(int >I<fd>B<, char *>I<buf>B<, size_t >I<nbytes> B<, "
782 "off_t *>I<basep>B<);>"
783 msgstr ""
784
785 #. type: Plain text
786 #: build/C/man3/getdirentries.3:43
787 msgid "B<getdirentries>(): _BSD_SOURCE || _SVID_SOURCE"
788 msgstr ""
789
790 #. type: Plain text
791 #: build/C/man3/getdirentries.3:56
792 msgid ""
793 "Read directory entries from the directory specified by I<fd> into I<buf>.  "
794 "At most I<nbytes> are read.  Reading starts at offset I<*basep>, and "
795 "I<*basep> is updated with the new position after reading."
796 msgstr ""
797
798 #. type: Plain text
799 #: build/C/man3/getdirentries.3:62
800 msgid ""
801 "B<getdirentries>()  returns the number of bytes read or zero when at the end "
802 "of the directory.  If an error occurs, -1 is returned, and I<errno> is set "
803 "appropriately."
804 msgstr ""
805
806 #. type: Plain text
807 #: build/C/man3/getdirentries.3:64
808 msgid "See the Linux library source code for details."
809 msgstr ""
810
811 #. type: Plain text
812 #: build/C/man3/getdirentries.3:69
813 msgid "The B<getdirentries>()  function is thread-safe."
814 msgstr ""
815
816 #. type: Plain text
817 #: build/C/man3/getdirentries.3:77
818 msgid ""
819 "Not in POSIX.1-2001.  Present on the BSDs, and a few other systems.  Use "
820 "B<opendir>(3)  and B<readdir>(3)  instead."
821 msgstr ""
822
823 #. type: Plain text
824 #: build/C/man3/getdirentries.3:80
825 msgid "B<lseek>(2), B<open>(2)"
826 msgstr ""
827
828 #. type: TH
829 #: build/C/man3/opendir.3:32
830 #, no-wrap
831 msgid "OPENDIR"
832 msgstr ""
833
834 #. type: TH
835 #: build/C/man3/opendir.3:32
836 #, no-wrap
837 msgid "2010-06-20"
838 msgstr ""
839
840 #. type: Plain text
841 #: build/C/man3/opendir.3:35
842 msgid "opendir, fdopendir - open a directory"
843 msgstr ""
844
845 #. type: Plain text
846 #: build/C/man3/opendir.3:43
847 #, no-wrap
848 msgid ""
849 "B<DIR *opendir(const char *>I<name>B<);>\n"
850 "B<DIR *fdopendir(int >I<fd>B<);>\n"
851 msgstr ""
852
853 #. type: Plain text
854 #: build/C/man3/opendir.3:51
855 msgid "B<fdopendir>():"
856 msgstr ""
857
858 #. type: TP
859 #: build/C/man3/opendir.3:54
860 #, no-wrap
861 msgid "Since glibc 2.10:"
862 msgstr ""
863
864 #. type: Plain text
865 #: build/C/man3/opendir.3:57
866 msgid "_XOPEN_SOURCE\\ E<gt>=\\ 700 || _POSIX_C_SOURCE\\ E<gt>=\\ 200809L"
867 msgstr ""
868
869 #. type: TP
870 #: build/C/man3/opendir.3:57
871 #, no-wrap
872 msgid "Before glibc 2.10:"
873 msgstr ""
874
875 #. type: Plain text
876 #: build/C/man3/opendir.3:60
877 msgid "_GNU_SOURCE"
878 msgstr ""
879
880 #. type: Plain text
881 #: build/C/man3/opendir.3:69
882 msgid ""
883 "The B<opendir>()  function opens a directory stream corresponding to the "
884 "directory I<name>, and returns a pointer to the directory stream.  The "
885 "stream is positioned at the first entry in the directory."
886 msgstr ""
887
888 #. type: Plain text
889 #: build/C/man3/opendir.3:83
890 msgid ""
891 "The B<fdopendir>()  function is like B<opendir>(), but returns a directory "
892 "stream for the directory referred to by the open file descriptor I<fd>.  "
893 "After a successful call to B<fdopendir>(), I<fd> is used internally by the "
894 "implementation, and should not otherwise be used by the application."
895 msgstr ""
896
897 #. type: Plain text
898 #: build/C/man3/opendir.3:92
899 msgid ""
900 "The B<opendir>()  and B<fdopendir>()  functions return a pointer to the "
901 "directory stream.  On error, NULL is returned, and I<errno> is set "
902 "appropriately."
903 msgstr ""
904
905 #. type: TP
906 #: build/C/man3/opendir.3:93
907 #, no-wrap
908 msgid "B<EACCES>"
909 msgstr ""
910
911 #. type: Plain text
912 #: build/C/man3/opendir.3:96
913 msgid "Permission denied."
914 msgstr ""
915
916 #. type: Plain text
917 #: build/C/man3/opendir.3:100
918 msgid "I<fd> is not a valid file descriptor opened for reading."
919 msgstr ""
920
921 #. type: TP
922 #: build/C/man3/opendir.3:100
923 #, no-wrap
924 msgid "B<EMFILE>"
925 msgstr ""
926
927 #. type: Plain text
928 #: build/C/man3/opendir.3:103
929 msgid "Too many file descriptors in use by process."
930 msgstr ""
931
932 #. type: TP
933 #: build/C/man3/opendir.3:103
934 #, no-wrap
935 msgid "B<ENFILE>"
936 msgstr ""
937
938 #. type: Plain text
939 #: build/C/man3/opendir.3:106
940 msgid "Too many files are currently open in the system."
941 msgstr ""
942
943 #. type: Plain text
944 #: build/C/man3/opendir.3:109
945 msgid "Directory does not exist, or I<name> is an empty string."
946 msgstr ""
947
948 #. type: TP
949 #: build/C/man3/opendir.3:109 build/C/man3/scandir.3:204
950 #, no-wrap
951 msgid "B<ENOMEM>"
952 msgstr ""
953
954 #. type: Plain text
955 #: build/C/man3/opendir.3:112 build/C/man3/scandir.3:207
956 msgid "Insufficient memory to complete the operation."
957 msgstr ""
958
959 #. type: Plain text
960 #: build/C/man3/opendir.3:115
961 msgid "I<name> is not a directory."
962 msgstr ""
963
964 #. type: SH
965 #: build/C/man3/opendir.3:115 build/C/man3/scandir.3:223
966 #, no-wrap
967 msgid "VERSIONS"
968 msgstr ""
969
970 #. type: Plain text
971 #: build/C/man3/opendir.3:118
972 msgid "B<fdopendir>()  is available in glibc since version 2.4."
973 msgstr ""
974
975 #. type: Plain text
976 #: build/C/man3/opendir.3:123
977 msgid ""
978 "B<opendir>()  is present on SVr4, 4.3BSD, and specified in POSIX.1-2001.  "
979 "B<fdopendir>()  is specified in POSIX.1-2008."
980 msgstr ""
981
982 #. type: Plain text
983 #: build/C/man3/opendir.3:126
984 msgid ""
985 "The underlying file descriptor of the directory stream can be obtained using "
986 "B<dirfd>(3)."
987 msgstr ""
988
989 #. type: Plain text
990 #: build/C/man3/opendir.3:140
991 msgid ""
992 "The B<opendir>()  function sets the close-on-exec flag for the file "
993 "descriptor underlying the I<DIR *>.  The B<fdopendir>()  function leaves the "
994 "setting of the close-on-exec flag unchanged for the file descriptor, I<fd>.  "
995 "POSIX.1-200x leaves it unspecified whether a successful call to "
996 "B<fdopendir>()  will set the close-on-exec flag for the file descriptor, "
997 "I<fd>."
998 msgstr ""
999
1000 #. type: Plain text
1001 #: build/C/man3/opendir.3:149
1002 msgid ""
1003 "B<open>(2), B<closedir>(3), B<dirfd>(3), B<readdir>(3), B<rewinddir>(3), "
1004 "B<scandir>(3), B<seekdir>(3), B<telldir>(3)"
1005 msgstr ""
1006
1007 #. type: TH
1008 #: build/C/man2/readdir.2:30 build/C/man3/readdir.3:36
1009 #, no-wrap
1010 msgid "READDIR"
1011 msgstr ""
1012
1013 #. type: TH
1014 #: build/C/man2/readdir.2:30 build/C/man3/readdir.3:36
1015 #, no-wrap
1016 msgid "2013-06-21"
1017 msgstr ""
1018
1019 #. type: Plain text
1020 #: build/C/man2/readdir.2:33
1021 msgid "readdir - read directory entry"
1022 msgstr ""
1023
1024 #. type: Plain text
1025 #: build/C/man2/readdir.2:38
1026 #, no-wrap
1027 msgid ""
1028 "B<int readdir(unsigned int >I<fd>B<, struct old_linux_dirent *>I<dirp>B<,>\n"
1029 "B<            unsigned int >I<count>B<);>\n"
1030 msgstr ""
1031
1032 #. type: Plain text
1033 #: build/C/man2/readdir.2:50
1034 msgid ""
1035 "This is not the function you are interested in.  Look at B<readdir>(3)  for "
1036 "the POSIX conforming C library interface.  This page documents the bare "
1037 "kernel system call interface, which is superseded by B<getdents>(2)."
1038 msgstr ""
1039
1040 #. type: Plain text
1041 #: build/C/man2/readdir.2:64
1042 msgid ""
1043 "B<readdir>()  reads one I<old_linux_dirent> structure from the directory "
1044 "referred to by the file descriptor I<fd> into the buffer pointed to by "
1045 "I<dirp>.  The argument I<count> is ignored; at most one I<old_linux_dirent> "
1046 "structure is read."
1047 msgstr ""
1048
1049 #. type: Plain text
1050 #: build/C/man2/readdir.2:68
1051 msgid "The I<old_linux_dirent> structure is declared as follows:"
1052 msgstr ""
1053
1054 #. type: Plain text
1055 #: build/C/man2/readdir.2:77
1056 #, no-wrap
1057 msgid ""
1058 "struct old_linux_dirent {\n"
1059 "    long  d_ino;              /* inode number */\n"
1060 "    off_t d_off;              /* offset to this I<old_linux_dirent> */\n"
1061 "    unsigned short d_reclen;  /* length of this I<d_name> */\n"
1062 "    char  d_name[NAME_MAX+1]; /* filename (null-terminated) */\n"
1063 "}\n"
1064 msgstr ""
1065
1066 #. type: Plain text
1067 #: build/C/man2/readdir.2:91
1068 msgid ""
1069 "I<d_ino> is an inode number.  I<d_off> is the distance from the start of the "
1070 "directory to this I<old_linux_dirent>.  I<d_reclen> is the size of "
1071 "I<d_name>, not counting the terminating null byte (\\(aq\\e0\\(aq).  "
1072 "I<d_name> is a null-terminated filename."
1073 msgstr ""
1074
1075 #. type: Plain text
1076 #: build/C/man2/readdir.2:97
1077 msgid ""
1078 "On success, 1 is returned.  On end of directory, 0 is returned.  On error, "
1079 "-1 is returned, and I<errno> is set appropriately."
1080 msgstr ""
1081
1082 #. type: Plain text
1083 #: build/C/man2/readdir.2:116
1084 msgid "This system call is Linux-specific."
1085 msgstr ""
1086
1087 #. type: Plain text
1088 #: build/C/man2/readdir.2:125
1089 msgid ""
1090 "Glibc does not provide a wrapper for this system call; call it using "
1091 "B<syscall>(2).  You will need to define the I<old_linux_dirent> structure "
1092 "yourself.  However, probably you should use B<readdir>(3)  instead."
1093 msgstr ""
1094
1095 #. type: Plain text
1096 #: build/C/man2/readdir.2:127
1097 msgid "This system call does not exist on x86-64."
1098 msgstr ""
1099
1100 #. type: Plain text
1101 #: build/C/man2/readdir.2:130
1102 msgid "B<getdents>(2), B<readdir>(3)"
1103 msgstr ""
1104
1105 #. type: Plain text
1106 #: build/C/man3/readdir.3:39
1107 msgid "readdir, readdir_r - read a directory"
1108 msgstr ""
1109
1110 #. type: Plain text
1111 #: build/C/man3/readdir.3:44
1112 #, no-wrap
1113 msgid "B<struct dirent *readdir(DIR *>I<dirp>B<);>\n"
1114 msgstr ""
1115
1116 #. type: Plain text
1117 #: build/C/man3/readdir.3:47
1118 #, no-wrap
1119 msgid ""
1120 "B<int readdir_r(DIR *>I<dirp>B<, struct dirent *>I<entry>B<, struct dirent "
1121 "**>I<result>B<);>\n"
1122 msgstr ""
1123
1124 #. type: Plain text
1125 #: build/C/man3/readdir.3:56
1126 msgid "B<readdir_r>():"
1127 msgstr ""
1128
1129 #. type: Plain text
1130 #: build/C/man3/readdir.3:59
1131 msgid ""
1132 "_POSIX_C_SOURCE\\ E<gt>=\\ 1 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE "
1133 "|| _POSIX_SOURCE"
1134 msgstr ""
1135
1136 #. type: Plain text
1137 #: build/C/man3/readdir.3:69
1138 msgid ""
1139 "The B<readdir>()  function returns a pointer to a I<dirent> structure "
1140 "representing the next directory entry in the directory stream pointed to by "
1141 "I<dirp>.  It returns NULL on reaching the end of the directory stream or if "
1142 "an error occurred."
1143 msgstr ""
1144
1145 #. type: Plain text
1146 #: build/C/man3/readdir.3:73
1147 msgid "On Linux, the I<dirent> structure is defined as follows:"
1148 msgstr ""
1149
1150 #. type: Plain text
1151 #: build/C/man3/readdir.3:84
1152 #, no-wrap
1153 msgid ""
1154 "struct dirent {\n"
1155 "    ino_t          d_ino;       /* inode number */\n"
1156 "    off_t          d_off;       /* not an offset; see NOTES */\n"
1157 "    unsigned short d_reclen;    /* length of this record */\n"
1158 "    unsigned char  d_type;      /* type of file; not supported\n"
1159 "                                   by all filesystem types */\n"
1160 "    char           d_name[256]; /* filename */\n"
1161 "};\n"
1162 msgstr ""
1163
1164 #. type: Plain text
1165 #: build/C/man3/readdir.3:98
1166 msgid ""
1167 "The only fields in the I<dirent> structure that are mandated by POSIX.1 are: "
1168 "I<d_name>[], of unspecified size, with at most B<NAME_MAX> characters "
1169 "preceding the terminating null byte (\\(aq\\e0\\(aq); and (as an XSI "
1170 "extension)  I<d_ino>.  The other fields are unstandardized, and not present "
1171 "on all systems; see NOTES below for some further details."
1172 msgstr ""
1173
1174 #. type: Plain text
1175 #: build/C/man3/readdir.3:104
1176 msgid ""
1177 "The data returned by B<readdir>()  may be overwritten by subsequent calls to "
1178 "B<readdir>()  for the same directory stream."
1179 msgstr ""
1180
1181 #. type: Plain text
1182 #: build/C/man3/readdir.3:119
1183 msgid ""
1184 "The B<readdir_r>()  function is a reentrant version of B<readdir>().  It "
1185 "reads the next directory entry from the directory stream I<dirp>, and "
1186 "returns it in the caller-allocated buffer pointed to by I<entry>.  (See "
1187 "NOTES for information on allocating this buffer.)  A pointer to the returned "
1188 "item is placed in I<*result>; if the end of the directory stream was "
1189 "encountered, then NULL is instead returned in I<*result>."
1190 msgstr ""
1191
1192 #. type: Plain text
1193 #: build/C/man3/readdir.3:134
1194 msgid ""
1195 "On success, B<readdir>()  returns a pointer to a I<dirent> structure.  (This "
1196 "structure may be statically allocated; do not attempt to B<free>(3)  it.)  "
1197 "If the end of the directory stream is reached, NULL is returned and I<errno> "
1198 "is not changed.  If an error occurs, NULL is returned and I<errno> is set "
1199 "appropriately."
1200 msgstr ""
1201
1202 #. type: Plain text
1203 #: build/C/man3/readdir.3:143
1204 msgid ""
1205 "The B<readdir_r>()  function returns 0 on success.  On error, it returns a "
1206 "positive error number (listed under ERRORS).  If the end of the directory "
1207 "stream is reached, B<readdir_r>()  returns 0, and returns NULL in "
1208 "I<*result>."
1209 msgstr ""
1210
1211 #. type: Plain text
1212 #: build/C/man3/readdir.3:152
1213 msgid "The B<readdir>()  function is not thread-safe."
1214 msgstr ""
1215
1216 #. type: Plain text
1217 #: build/C/man3/readdir.3:156
1218 msgid "The B<readdir_r>()  function is thread-safe."
1219 msgstr ""
1220
1221 #. type: Plain text
1222 #: build/C/man3/readdir.3:158 build/C/man3/rewinddir.3:60
1223 msgid "SVr4, 4.3BSD, POSIX.1-2001."
1224 msgstr ""
1225
1226 #. type: Plain text
1227 #: build/C/man3/readdir.3:174
1228 msgid ""
1229 "Only the fields I<d_name> and I<d_ino> are specified in POSIX.1-2001.  The "
1230 "remaining fields are available on many, but not all systems.  Under glibc, "
1231 "programs can check for the availability of the fields not defined in POSIX.1 "
1232 "by testing whether the macros B<_DIRENT_HAVE_D_NAMLEN>, "
1233 "B<_DIRENT_HAVE_D_RECLEN>, B<_DIRENT_HAVE_D_OFF>, or B<_DIRENT_HAVE_D_TYPE> "
1234 "are defined."
1235 msgstr ""
1236
1237 #.  https://lwn.net/Articles/544298/
1238 #. type: Plain text
1239 #: build/C/man3/readdir.3:187
1240 msgid ""
1241 "The value returned in I<d_off> is the same as would be returned by calling "
1242 "B<telldir>(3)  at the current position in the directory stream.  Be aware "
1243 "that despite its type and name, the I<d_off> field is seldom any kind of "
1244 "directory offset on modern filesystems.  Applications should treat this "
1245 "field as an opaque value, making no assumptions about its contents; see also "
1246 "B<telldir>(3)."
1247 msgstr ""
1248
1249 #. type: Plain text
1250 #: build/C/man3/readdir.3:200
1251 msgid ""
1252 "Other than Linux, the I<d_type> field is available mainly only on BSD "
1253 "systems.  This field makes it possible to avoid the expense of calling "
1254 "B<lstat>(2)  if further actions depend on the type of the file.  If the "
1255 "B<_BSD_SOURCE> feature test macro is defined, then glibc defines the "
1256 "following macro constants for the value returned in I<d_type>:"
1257 msgstr ""
1258
1259 #. type: Plain text
1260 #: build/C/man3/readdir.3:231
1261 msgid ""
1262 "If the file type could not be determined, the value B<DT_UNKNOWN> is "
1263 "returned in I<d_type>."
1264 msgstr ""
1265
1266 #. type: Plain text
1267 #: build/C/man3/readdir.3:250
1268 msgid ""
1269 "Since POSIX.1 does not specify the size of the I<d_name> field, and other "
1270 "nonstandard fields may precede that field within the I<dirent> structure, "
1271 "portable applications that use B<readdir_r>()  should allocate the buffer "
1272 "whose address is passed in I<entry> as follows:"
1273 msgstr ""
1274
1275 #. type: Plain text
1276 #: build/C/man3/readdir.3:258
1277 #, no-wrap
1278 msgid ""
1279 "name_max = pathconf(dirpath, _PC_NAME_MAX);\n"
1280 "if (name_max == -1)         /* Limit not defined, or error */\n"
1281 "    name_max = 255;         /* Take a guess */\n"
1282 "len = offsetof(struct dirent, d_name) + name_max + 1;\n"
1283 "entryp = malloc(len);\n"
1284 msgstr ""
1285
1286 #. type: Plain text
1287 #: build/C/man3/readdir.3:265
1288 msgid "(POSIX.1 requires that I<d_name> is the last field in a I<struct dirent>.)"
1289 msgstr ""
1290
1291 #. type: Plain text
1292 #: build/C/man3/readdir.3:277
1293 msgid ""
1294 "B<getdents>(2), B<read>(2), B<closedir>(3), B<dirfd>(3), B<ftw>(3), "
1295 "B<offsetof>(3), B<opendir>(3), B<rewinddir>(3), B<scandir>(3), "
1296 "B<seekdir>(3), B<telldir>(3)"
1297 msgstr ""
1298
1299 #. type: TH
1300 #: build/C/man3/rewinddir.3:31
1301 #, no-wrap
1302 msgid "REWINDDIR"
1303 msgstr ""
1304
1305 #. type: TH
1306 #: build/C/man3/rewinddir.3:31 build/C/man3/telldir.3:30
1307 #, no-wrap
1308 msgid "2013-09-02"
1309 msgstr ""
1310
1311 #. type: Plain text
1312 #: build/C/man3/rewinddir.3:34
1313 msgid "rewinddir - reset directory stream"
1314 msgstr ""
1315
1316 #. type: Plain text
1317 #: build/C/man3/rewinddir.3:41
1318 #, no-wrap
1319 msgid "B<void rewinddir(DIR *>I<dirp>B<);>\n"
1320 msgstr ""
1321
1322 #. type: Plain text
1323 #: build/C/man3/rewinddir.3:49
1324 msgid ""
1325 "The B<rewinddir>()  function resets the position of the directory stream "
1326 "I<dirp> to the beginning of the directory."
1327 msgstr ""
1328
1329 #. type: Plain text
1330 #: build/C/man3/rewinddir.3:53
1331 msgid "The B<rewinddir>()  function returns no value."
1332 msgstr ""
1333
1334 #. type: Plain text
1335 #: build/C/man3/rewinddir.3:58
1336 msgid "The B<rewinddir>()  function is thread-safe."
1337 msgstr ""
1338
1339 #. type: Plain text
1340 #: build/C/man3/rewinddir.3:67
1341 msgid ""
1342 "B<closedir>(3), B<opendir>(3), B<readdir>(3), B<scandir>(3), B<seekdir>(3), "
1343 "B<telldir>(3)"
1344 msgstr ""
1345
1346 #. type: TH
1347 #: build/C/man3/scandir.3:62
1348 #, no-wrap
1349 msgid "SCANDIR"
1350 msgstr ""
1351
1352 #. type: TH
1353 #: build/C/man3/scandir.3:62
1354 #, no-wrap
1355 msgid "2014-05-28"
1356 msgstr ""
1357
1358 #. type: Plain text
1359 #: build/C/man3/scandir.3:66
1360 msgid ""
1361 "scandir, scandirat, alphasort, versionsort - scan a directory for matching "
1362 "entries"
1363 msgstr ""
1364
1365 #. type: Plain text
1366 #: build/C/man3/scandir.3:71
1367 #, no-wrap
1368 msgid "B<int scandir(const char *>I<dirp>B<, struct dirent ***>I<namelist>B<,>\n"
1369 msgstr ""
1370
1371 #. type: Plain text
1372 #: build/C/man3/scandir.3:74 build/C/man3/scandir.3:90
1373 #, no-wrap
1374 msgid ""
1375 "B<int (*>I<filter>B<)(const struct dirent *),>\n"
1376 "B<int (*>I<compar>B<)(const struct dirent **, const struct dirent **));>\n"
1377 msgstr ""
1378
1379 #. type: Plain text
1380 #: build/C/man3/scandir.3:77
1381 #, no-wrap
1382 msgid ""
1383 "B<int alphasort(const struct dirent **>I<a>B<, const struct dirent "
1384 "**>I<b>B<);>\n"
1385 msgstr ""
1386
1387 #. type: Plain text
1388 #: build/C/man3/scandir.3:79
1389 #, no-wrap
1390 msgid ""
1391 "B<int versionsort(const struct dirent **>I<a>B<, const struct dirent "
1392 "**>I<b>B<);>\n"
1393 msgstr ""
1394
1395 #. type: Plain text
1396 #: build/C/man3/scandir.3:82
1397 #, no-wrap
1398 msgid ""
1399 "B<#include E<lt>fcntl.hE<gt>>          /* Definition of AT_* constants */\n"
1400 "B<#include E<lt>dirent.hE<gt>>\n"
1401 msgstr ""
1402
1403 #. type: Plain text
1404 #: build/C/man3/scandir.3:86
1405 msgid ""
1406 "B<int scandirat(int >I<dirfd>B<, const char *>I<dirp>B<,> B<struct dirent "
1407 "***>I<namelist>B<,>"
1408 msgstr ""
1409
1410 #. type: Plain text
1411 #: build/C/man3/scandir.3:100
1412 msgid "B<scandir>(), B<alphasort>():"
1413 msgstr ""
1414
1415 #. type: Plain text
1416 #: build/C/man3/scandir.3:115
1417 msgid "B<versionsort>(): _GNU_SOURCE"
1418 msgstr ""
1419
1420 #. type: Plain text
1421 #: build/C/man3/scandir.3:118
1422 msgid "B<scandirat>(): _GNU_SOURCE"
1423 msgstr ""
1424
1425 #. type: Plain text
1426 #: build/C/man3/scandir.3:133
1427 msgid ""
1428 "The B<scandir>()  function scans the directory I<dirp>, calling I<filter>() "
1429 "on each directory entry.  Entries for which I<filter>() returns nonzero are "
1430 "stored in strings allocated via B<malloc>(3), sorted using B<qsort>(3)  with "
1431 "the comparison function I<compar>(), and collected in array I<namelist> "
1432 "which is allocated via B<malloc>(3).  If I<filter> is NULL, all entries are "
1433 "selected."
1434 msgstr ""
1435
1436 #. type: Plain text
1437 #: build/C/man3/scandir.3:145
1438 msgid ""
1439 "The B<alphasort>()  and B<versionsort>()  functions can be used as the "
1440 "comparison function I<compar>().  The former sorts directory entries using "
1441 "B<strcoll>(3), the latter using B<strverscmp>(3)  on the strings "
1442 "I<(*a)-E<gt>d_name> and I<(*b)-E<gt>d_name>."
1443 msgstr ""
1444
1445 #. type: SS
1446 #: build/C/man3/scandir.3:145
1447 #, no-wrap
1448 msgid "scandirat()"
1449 msgstr ""
1450
1451 #. type: Plain text
1452 #: build/C/man3/scandir.3:151
1453 msgid ""
1454 "The B<scandirat>()  function operates in exactly the same way as "
1455 "B<scandir>(), except for the differences described here."
1456 msgstr ""
1457
1458 #. type: Plain text
1459 #: build/C/man3/scandir.3:161
1460 msgid ""
1461 "If the pathname given in I<dirp> is relative, then it is interpreted "
1462 "relative to the directory referred to by the file descriptor I<dirfd> "
1463 "(rather than relative to the current working directory of the calling "
1464 "process, as is done by B<scandir>()  for a relative pathname)."
1465 msgstr ""
1466
1467 #. type: Plain text
1468 #: build/C/man3/scandir.3:173
1469 msgid ""
1470 "If I<dirp> is relative and I<dirfd> is the special value B<AT_FDCWD>, then "
1471 "I<dirp> is interpreted relative to the current working directory of the "
1472 "calling process (like B<scandir>())."
1473 msgstr ""
1474
1475 #. type: Plain text
1476 #: build/C/man3/scandir.3:179
1477 msgid "If I<dirp> is absolute, then I<dirfd> is ignored."
1478 msgstr ""
1479
1480 #. type: Plain text
1481 #: build/C/man3/scandir.3:184
1482 msgid "See B<openat>(2)  for an explanation of the need for B<scandirat>()."
1483 msgstr ""
1484
1485 #. type: Plain text
1486 #: build/C/man3/scandir.3:192
1487 msgid ""
1488 "The B<scandir>()  function returns the number of directory entries "
1489 "selected.  On error, -1 is returned, with I<errno> set to indicate the cause "
1490 "of the error."
1491 msgstr ""
1492
1493 #. type: Plain text
1494 #: build/C/man3/scandir.3:200
1495 msgid ""
1496 "The B<alphasort>()  and B<versionsort>()  functions return an integer less "
1497 "than, equal to, or greater than zero if the first argument is considered to "
1498 "be respectively less than, equal to, or greater than the second."
1499 msgstr ""
1500
1501 #. type: Plain text
1502 #: build/C/man3/scandir.3:204
1503 msgid "The path in I<dirp> does not exist."
1504 msgstr ""
1505
1506 #. type: Plain text
1507 #: build/C/man3/scandir.3:210
1508 msgid "The path in I<dirp> is not a directory."
1509 msgstr ""
1510
1511 #. type: Plain text
1512 #: build/C/man3/scandir.3:213
1513 msgid "The following additional errors can occur for B<scandirat>():"
1514 msgstr ""
1515
1516 #. type: Plain text
1517 #: build/C/man3/scandir.3:217
1518 msgid "I<dirfd> is not a valid file descriptor."
1519 msgstr ""
1520
1521 #. type: Plain text
1522 #: build/C/man3/scandir.3:223
1523 msgid ""
1524 "I<dirp> is a relative path and I<dirfd> is a file descriptor referring to a "
1525 "file other than a directory."
1526 msgstr ""
1527
1528 #. type: Plain text
1529 #: build/C/man3/scandir.3:226
1530 msgid "B<versionsort>()  was added to glibc in version 2.1."
1531 msgstr ""
1532
1533 #. type: Plain text
1534 #: build/C/man3/scandir.3:229
1535 msgid "B<scandirat>()  was added to glibc in version 2.15."
1536 msgstr ""
1537
1538 #. type: Plain text
1539 #: build/C/man3/scandir.3:233
1540 msgid "B<alphasort>(), B<scandir>(): 4.3BSD, POSIX.1-2008."
1541 msgstr ""
1542
1543 #.  .LP
1544 #.  The functions
1545 #.  .BR scandir ()
1546 #.  and
1547 #.  .BR alphasort ()
1548 #.  are from 4.3BSD, and have been available under Linux since libc4.
1549 #.  Libc4 and libc5 use the more precise prototype
1550 #.  .sp
1551 #.  .nf
1552 #.     int alphasort(const struct dirent ** a,
1553 #.                   const struct dirent **b);
1554 #.  .fi
1555 #.  .sp
1556 #.  but glibc 2.0 returns to the imprecise BSD prototype.
1557 #. type: Plain text
1558 #: build/C/man3/scandir.3:252
1559 msgid "B<versionsort>()  and B<scandirat>()  are GNU extensions."
1560 msgstr ""
1561
1562 #. type: Plain text
1563 #: build/C/man3/scandir.3:259
1564 msgid ""
1565 "Since glibc 2.1, B<alphasort>()  calls B<strcoll>(3); earlier it used "
1566 "B<strcmp>(3)."
1567 msgstr ""
1568
1569 #. type: Plain text
1570 #: build/C/man3/scandir.3:264
1571 #, no-wrap
1572 msgid ""
1573 "#define _SVID_SOURCE\n"
1574 "/* print files in current directory in reverse order */\n"
1575 "#include E<lt>dirent.hE<gt>\n"
1576 msgstr ""
1577
1578 #. type: Plain text
1579 #: build/C/man3/scandir.3:270
1580 #, no-wrap
1581 msgid ""
1582 "int\n"
1583 "main(void)\n"
1584 "{\n"
1585 "    struct dirent **namelist;\n"
1586 "    int n;\n"
1587 msgstr ""
1588
1589 #. type: Plain text
1590 #: build/C/man3/scandir.3:282
1591 #, no-wrap
1592 msgid ""
1593 "    n = scandir(\".\", &namelist, NULL, alphasort);\n"
1594 "    if (n E<lt> 0)\n"
1595 "        perror(\"scandir\");\n"
1596 "    else {\n"
1597 "        while (n--) {\n"
1598 "            printf(\"%s\\en\", namelist[n]-E<gt>d_name);\n"
1599 "            free(namelist[n]);\n"
1600 "        }\n"
1601 "        free(namelist);\n"
1602 "    }\n"
1603 "}\n"
1604 msgstr ""
1605
1606 #. type: Plain text
1607 #: build/C/man3/scandir.3:294
1608 msgid ""
1609 "B<closedir>(3), B<fnmatch>(3), B<opendir>(3), B<readdir>(3), "
1610 "B<rewinddir>(3), B<seekdir>(3), B<strcmp>(3), B<strcoll>(3), "
1611 "B<strverscmp>(3), B<telldir>(3)"
1612 msgstr ""
1613
1614 #. type: TH
1615 #: build/C/man3/seekdir.3:31
1616 #, no-wrap
1617 msgid "SEEKDIR"
1618 msgstr ""
1619
1620 #. type: TH
1621 #: build/C/man3/seekdir.3:31
1622 #, no-wrap
1623 msgid "2013-09-09"
1624 msgstr ""
1625
1626 #. type: Plain text
1627 #: build/C/man3/seekdir.3:35
1628 msgid ""
1629 "seekdir - set the position of the next readdir() call in the directory "
1630 "stream."
1631 msgstr ""
1632
1633 #. type: Plain text
1634 #: build/C/man3/seekdir.3:40
1635 #, no-wrap
1636 msgid "B<void seekdir(DIR *>I<dirp>B<, long >I<loc>B<);>\n"
1637 msgstr ""
1638
1639 #. type: Plain text
1640 #: build/C/man3/seekdir.3:49
1641 msgid "B<seekdir>(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE"
1642 msgstr ""
1643
1644 #. type: Plain text
1645 #: build/C/man3/seekdir.3:60
1646 msgid ""
1647 "The B<seekdir>()  function sets the location in the directory stream from "
1648 "which the next B<readdir>(2)  call will start.  The I<loc> argument should "
1649 "be a value returned by a previous call to B<telldir>(3)."
1650 msgstr ""
1651
1652 #. type: Plain text
1653 #: build/C/man3/seekdir.3:64
1654 msgid "The B<seekdir>()  function returns no value."
1655 msgstr ""
1656
1657 #. type: Plain text
1658 #: build/C/man3/seekdir.3:69
1659 msgid "The B<seekdir>()  function is thread-safe."
1660 msgstr ""
1661
1662 #. type: Plain text
1663 #: build/C/man3/seekdir.3:71 build/C/man3/telldir.3:71
1664 msgid "4.3BSD, POSIX.1-2001."
1665 msgstr ""
1666
1667 #. type: Plain text
1668 #: build/C/man3/seekdir.3:83
1669 msgid ""
1670 "In glibc up to version 2.1.1, the type of the I<loc> argument was I<off_t>.  "
1671 "POSIX.1-2001 specifies I<long>, and this is the type used since glibc "
1672 "2.1.2.  See B<telldir>(3)  for information on why you should be careful in "
1673 "making any assumptions about the value in this argument."
1674 msgstr ""
1675
1676 #. type: Plain text
1677 #: build/C/man3/seekdir.3:91
1678 msgid ""
1679 "B<lseek>(2), B<closedir>(3), B<opendir>(3), B<readdir>(3), B<rewinddir>(3), "
1680 "B<scandir>(3), B<telldir>(3)"
1681 msgstr ""
1682
1683 #. type: TH
1684 #: build/C/man3/telldir.3:30
1685 #, no-wrap
1686 msgid "TELLDIR"
1687 msgstr ""
1688
1689 #. type: Plain text
1690 #: build/C/man3/telldir.3:33
1691 msgid "telldir - return current location in directory stream"
1692 msgstr ""
1693
1694 #. type: Plain text
1695 #: build/C/man3/telldir.3:38
1696 #, no-wrap
1697 msgid "B<long telldir(DIR *>I<dirp>B<);>\n"
1698 msgstr ""
1699
1700 #. type: Plain text
1701 #: build/C/man3/telldir.3:47
1702 msgid "B<telldir>(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE"
1703 msgstr ""
1704
1705 #. type: Plain text
1706 #: build/C/man3/telldir.3:52
1707 msgid ""
1708 "The B<telldir>()  function returns the current location associated with the "
1709 "directory stream I<dirp>."
1710 msgstr ""
1711
1712 #. type: Plain text
1713 #: build/C/man3/telldir.3:60
1714 msgid ""
1715 "On success, the B<telldir>()  function returns the current location in the "
1716 "directory stream.  On error, -1 is returned, and I<errno> is set "
1717 "appropriately."
1718 msgstr ""
1719
1720 #. type: Plain text
1721 #: build/C/man3/telldir.3:69
1722 msgid "The B<telldir>()  function is thread-safe."
1723 msgstr ""
1724
1725 #. type: Plain text
1726 #: build/C/man3/telldir.3:79
1727 msgid ""
1728 "In glibc up to version 2.1.1, the return type of B<telldir>()  was "
1729 "I<off_t>.  POSIX.1-2001 specifies I<long>, and this is the type used since "
1730 "glibc 2.1.2."
1731 msgstr ""
1732
1733 #.  https://lwn.net/Articles/544298/
1734 #. type: Plain text
1735 #: build/C/man3/telldir.3:95
1736 msgid ""
1737 "In early filesystems, the value returned by B<telldir>()  was a simple file "
1738 "offset within a directory.  Modern filesystems use tree or hash structures, "
1739 "rather than flat tables, to represent directories.  On such filesystems, the "
1740 "value returned by B<telldir>()  (and used internally by B<readdir>(3))  is a "
1741 "\"cookie\" that is used by the implementation to derive a position within a "
1742 "directory.  Application programs should treat this strictly as an opaque "
1743 "value, making I<no> assumptions about its contents."
1744 msgstr ""
1745
1746 #. type: Plain text
1747 #: build/C/man3/telldir.3:102
1748 msgid ""
1749 "B<closedir>(3), B<opendir>(3), B<readdir>(3), B<rewinddir>(3), "
1750 "B<scandir>(3), B<seekdir>(3)"
1751 msgstr ""