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.
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2012-04-25 05:36+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"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
20 #: build/C/man3/closedir.3:29
26 #: build/C/man3/closedir.3:29
32 #: build/C/man3/closedir.3:29 build/C/man3/dirfd.3:23 build/C/man2/getdents.2:27 build/C/man3/getdirentries.3:27 build/C/man3/opendir.3:30 build/C/man2/readdir.2:28 build/C/man3/readdir.3:34 build/C/man3/rewinddir.3:29 build/C/man3/scandir.3:34 build/C/man3/scandirat.3:26 build/C/man3/seekdir.3:28 build/C/man3/telldir.3:28
34 msgid "Linux Programmer's Manual"
38 #: build/C/man3/closedir.3:30 build/C/man3/dirfd.3:24 build/C/man2/getdents.2:28 build/C/man3/getdirentries.3:28 build/C/man3/opendir.3:31 build/C/man2/readdir.2:29 build/C/man3/readdir.3:35 build/C/man3/rewinddir.3:30 build/C/man3/scandir.3:35 build/C/man3/scandirat.3:27 build/C/man3/seekdir.3:29 build/C/man3/telldir.3:29
44 #: build/C/man3/closedir.3:32
45 msgid "closedir - close a directory"
49 #: build/C/man3/closedir.3:32 build/C/man3/dirfd.3:26 build/C/man2/getdents.2:30 build/C/man3/getdirentries.3:30 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:37 build/C/man3/scandirat.3:29 build/C/man3/seekdir.3:32 build/C/man3/telldir.3:31
55 #: build/C/man3/closedir.3:35 build/C/man3/opendir.3:36 build/C/man3/rewinddir.3:35
57 msgid "B<#include E<lt>sys/types.hE<gt>>\n"
61 #: build/C/man3/closedir.3:37 build/C/man3/opendir.3:38 build/C/man3/readdir.3:40 build/C/man3/rewinddir.3:37 build/C/man3/scandir.3:40 build/C/man3/seekdir.3:35 build/C/man3/telldir.3:34
63 msgid "B<#include E<lt>dirent.hE<gt>>\n"
67 #: build/C/man3/closedir.3:39
69 msgid "B<int closedir(DIR *>I<dirp>B<);>\n"
73 #: build/C/man3/closedir.3:40 build/C/man3/dirfd.3:52 build/C/man2/getdents.2:35 build/C/man3/getdirentries.3:43 build/C/man3/opendir.3:61 build/C/man2/readdir.2:37 build/C/man3/readdir.3:59 build/C/man3/rewinddir.3:40 build/C/man3/scandir.3:63 build/C/man3/scandirat.3:45 build/C/man3/seekdir.3:46 build/C/man3/telldir.3:45
79 #: build/C/man3/closedir.3:51
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."
88 #: build/C/man3/closedir.3:51 build/C/man3/dirfd.3:67 build/C/man2/getdents.2:136 build/C/man3/getdirentries.3:56 build/C/man3/opendir.3:81 build/C/man2/readdir.2:86 build/C/man3/readdir.3:117 build/C/man3/rewinddir.3:45 build/C/man3/scandir.3:90 build/C/man3/scandirat.3:79 build/C/man3/seekdir.3:58 build/C/man3/telldir.3:50
94 #: build/C/man3/closedir.3:58
96 "The B<closedir>() function returns 0 on success. On error, -1 is returned, "
97 "and I<errno> is set appropriately."
101 #: build/C/man3/closedir.3:58 build/C/man3/dirfd.3:70 build/C/man2/getdents.2:142 build/C/man3/getdirentries.3:62 build/C/man3/opendir.3:90 build/C/man2/readdir.2:92 build/C/man3/readdir.3:141 build/C/man3/scandir.3:103 build/C/man3/scandirat.3:86 build/C/man3/telldir.3:58
107 #: build/C/man3/closedir.3:59 build/C/man2/getdents.2:143 build/C/man3/opendir.3:94 build/C/man2/readdir.2:93 build/C/man3/readdir.3:142 build/C/man3/scandirat.3:93 build/C/man3/telldir.3:59
113 #: build/C/man3/closedir.3:62 build/C/man3/readdir.3:145 build/C/man3/telldir.3:62
114 msgid "Invalid directory stream descriptor I<dirp>."
118 #: build/C/man3/closedir.3:62 build/C/man3/dirfd.3:83 build/C/man2/getdents.2:159 build/C/man3/getdirentries.3:64 build/C/man3/opendir.3:116 build/C/man2/readdir.2:109 build/C/man3/readdir.3:145 build/C/man3/rewinddir.3:49 build/C/man3/scandir.3:116 build/C/man3/scandirat.3:106 build/C/man3/seekdir.3:62 build/C/man3/telldir.3:62
120 msgid "CONFORMING TO"
124 #: build/C/man3/closedir.3:64
125 msgid "SVr4, POSIX.1-2001, 4.3BSD."
129 #: build/C/man3/closedir.3:64 build/C/man3/dirfd.3:95 build/C/man2/getdents.2:273 build/C/man3/getdirentries.3:72 build/C/man3/opendir.3:138 build/C/man2/readdir.2:117 build/C/man3/readdir.3:239 build/C/man3/rewinddir.3:51 build/C/man3/scandir.3:172 build/C/man3/scandirat.3:113 build/C/man3/seekdir.3:72 build/C/man3/telldir.3:72
135 #: build/C/man3/closedir.3:71
137 "B<close>(2), B<opendir>(3), B<readdir>(3), B<rewinddir>(3), B<scandir>(3), "
138 "B<seekdir>(3), B<telldir>(3)"
142 #: build/C/man3/dirfd.3:23
148 #: build/C/man3/dirfd.3:23
154 #: build/C/man3/dirfd.3:23 build/C/man2/getdents.2:27 build/C/man2/readdir.2:28 build/C/man3/scandirat.3:26
160 #: build/C/man3/dirfd.3:26
161 msgid "dirfd - get directory stream file descriptor"
165 #: build/C/man3/dirfd.3:28
166 msgid "B<#include E<lt>sys/types.hE<gt>>"
170 #: build/C/man3/dirfd.3:30 build/C/man3/getdirentries.3:32
171 msgid "B<#include E<lt>dirent.hE<gt>>"
175 #: build/C/man3/dirfd.3:32
176 msgid "B<int dirfd(DIR *>I<dirp>B<);>"
180 #: build/C/man3/dirfd.3:36 build/C/man3/getdirentries.3:39 build/C/man3/opendir.3:46 build/C/man3/readdir.3:50 build/C/man3/scandir.3:55 build/C/man3/seekdir.3:42 build/C/man3/telldir.3:41
181 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
185 #: build/C/man3/dirfd.3:39
190 #: build/C/man3/dirfd.3:44
191 msgid "_BSD_SOURCE || _SVID_SOURCE"
195 #: build/C/man3/dirfd.3:46
196 msgid "|| /* Since glibc 2.10: */"
200 #: build/C/man3/dirfd.3:48
201 msgid "(_POSIX_C_SOURCE\\ E<gt>=\\ 200809L || _XOPEN_SOURCE\\ E<gt>=\\ 700)"
205 #: build/C/man3/dirfd.3:57
207 "The function B<dirfd>() returns the file descriptor associated with the "
208 "directory stream I<dirp>."
212 #: build/C/man3/dirfd.3:67
214 "This descriptor is the one used internally by the directory stream. As a "
215 "result, it is only useful for functions which do not depend on or alter the "
216 "file position, such as B<fstat>(2) and B<fchdir>(2). It will be "
217 "automatically closed when B<closedir>(3) is called."
221 #: build/C/man3/dirfd.3:70
223 "On success, a nonnegative file descriptor is returned. On error, -1 is "
229 #: build/C/man3/dirfd.3:75
231 "POSIX.1-2008 specifies two errors, neither of which is returned by the "
232 "current implementation."
236 #: build/C/man3/dirfd.3:75 build/C/man2/getdents.2:150 build/C/man2/readdir.2:100
242 #: build/C/man3/dirfd.3:79
243 msgid "I<dirp> does not refer to a valid directory stream."
247 #: build/C/man3/dirfd.3:79
253 #: build/C/man3/dirfd.3:83
255 "The implementation does not support the association of a file descriptor "
259 #. It is present in libc5 (since 5.1.2) and in glibc2.
261 #: build/C/man3/dirfd.3:87
263 "POSIX.1-2008. This function was a BSD extension, present in 4.3BSD-Reno, "
268 #: build/C/man3/dirfd.3:87 build/C/man2/getdents.2:162 build/C/man3/opendir.3:121 build/C/man2/readdir.2:111 build/C/man3/readdir.3:147 build/C/man3/scandirat.3:108 build/C/man3/seekdir.3:64 build/C/man3/telldir.3:64
274 #: build/C/man3/dirfd.3:95
276 "The prototype for B<dirfd>() is only available if B<_BSD_SOURCE> or "
277 "B<_SVID_SOURCE> is defined."
281 #: build/C/man3/dirfd.3:103
283 "B<open>(2), B<closedir>(3), B<opendir>(3), B<readdir>(3), B<rewinddir>(3), "
284 "B<scandir>(3), B<seekdir>(3), B<telldir>(3)"
288 #: build/C/man2/getdents.2:27
294 #: build/C/man2/getdents.2:27
300 #: build/C/man2/getdents.2:30
301 msgid "getdents - get directory entries"
305 #: build/C/man2/getdents.2:34
308 "B<int getdents(unsigned int >I<fd>B<, struct linux_dirent *>I<dirp>B<,>\n"
309 "B< unsigned int >I<count>B<);>\n"
313 #: build/C/man2/getdents.2:41
315 "This is not the function you are interested in. Look at B<readdir>(3) for "
316 "the POSIX conforming C library interface. This page documents the bare "
317 "kernel system call interface."
321 #: build/C/man2/getdents.2:54
323 "The system call B<getdents>() reads several I<linux_dirent> structures from "
324 "the directory referred to by the open file descriptor I<fd> into the buffer "
325 "pointed to by I<dirp>. The argument I<count> specifies the size of that "
330 #: build/C/man2/getdents.2:58
331 msgid "The I<linux_dirent> structure is declared as follows:"
335 #: build/C/man2/getdents.2:73
338 "struct linux_dirent {\n"
339 " unsigned long d_ino; /* Inode number */\n"
340 " unsigned long d_off; /* Offset to next I<linux_dirent> */\n"
341 " unsigned short d_reclen; /* Length of this I<linux_dirent> */\n"
342 " char d_name[]; /* Filename (null-terminated) */\n"
343 " /* length is actually (d_reclen - 2 -\n"
344 " offsetof(struct linux_dirent, d_name) */\n"
346 " char pad; // Zero padding byte\n"
347 " char d_type; // File type (only since Linux 2.6.4;\n"
348 " // offset is (d_reclen - 1))\n"
353 #: build/C/man2/getdents.2:75
359 #: build/C/man2/getdents.2:88
361 "I<d_ino> is an inode number. I<d_off> is the distance from the start of the "
362 "directory to the start of the next I<linux_dirent>. I<d_reclen> is the size "
363 "of this entire I<linux_dirent>. I<d_name> is a null-terminated filename."
367 #: build/C/man2/getdents.2:93
369 "I<d_type> is a byte at the end of the structure that indicates the file "
370 "type. It contains one of the following values (defined in "
371 "I<E<lt>dirent.hE<gt>>):"
375 #: build/C/man2/getdents.2:93 build/C/man3/readdir.3:176
381 #: build/C/man2/getdents.2:96 build/C/man3/readdir.3:179
382 msgid "This is a block device."
386 #: build/C/man2/getdents.2:96 build/C/man3/readdir.3:179
392 #: build/C/man2/getdents.2:99 build/C/man3/readdir.3:182
393 msgid "This is a character device."
397 #: build/C/man2/getdents.2:99 build/C/man3/readdir.3:182
403 #: build/C/man2/getdents.2:102 build/C/man3/readdir.3:185
404 msgid "This is a directory."
408 #: build/C/man2/getdents.2:102 build/C/man3/readdir.3:185
414 #: build/C/man2/getdents.2:105 build/C/man3/readdir.3:188
415 msgid "This is a named pipe (FIFO)."
419 #: build/C/man2/getdents.2:105 build/C/man3/readdir.3:188
425 #: build/C/man2/getdents.2:108 build/C/man3/readdir.3:191
426 msgid "This is a symbolic link."
430 #: build/C/man2/getdents.2:108 build/C/man3/readdir.3:191
436 #: build/C/man2/getdents.2:111 build/C/man3/readdir.3:194
437 msgid "This is a regular file."
441 #: build/C/man2/getdents.2:111 build/C/man3/readdir.3:194
447 #: build/C/man2/getdents.2:114 build/C/man3/readdir.3:197
448 msgid "This is a UNIX domain socket."
452 #: build/C/man2/getdents.2:114 build/C/man3/readdir.3:197
454 msgid "B<DT_UNKNOWN>"
457 #. The glibc manual says that on some systems this is the only
460 #: build/C/man2/getdents.2:117 build/C/man3/readdir.3:202
461 msgid "The file type is unknown."
465 #: build/C/man2/getdents.2:127
467 "The I<d_type> field is implemented since Linux 2.6.4. It occupies a space "
468 "that was previously a zero-filled padding byte in the I<linux_dirent> "
469 "structure. Thus, on kernels before 2.6.3, attempting to access this field "
470 "always provides the value 0 (B<DT_UNKNOWN>)."
474 #. The same sentence is in getdents.2
476 #: build/C/man2/getdents.2:136 build/C/man3/readdir.3:216
478 "Currently, only some file systems (among them: Btrfs, ext2, ext3, and ext4) "
479 "have full support for returning the file type in I<d_type>. All "
480 "applications must properly handle a return of B<DT_UNKNOWN>."
484 #: build/C/man2/getdents.2:142
486 "On success, the number of bytes read is returned. On end of directory, 0 is "
487 "returned. On error, -1 is returned, and I<errno> is set appropriately."
491 #: build/C/man2/getdents.2:147 build/C/man2/readdir.2:97
492 msgid "Invalid file descriptor I<fd>."
496 #: build/C/man2/getdents.2:147 build/C/man2/readdir.2:97
502 #: build/C/man2/getdents.2:150 build/C/man2/readdir.2:100
503 msgid "Argument points outside the calling process's address space."
507 #: build/C/man2/getdents.2:153 build/C/man2/readdir.2:103
508 msgid "Result buffer is too small."
512 #: build/C/man2/getdents.2:153 build/C/man3/opendir.3:104 build/C/man2/readdir.2:103 build/C/man3/scandir.3:104
518 #: build/C/man2/getdents.2:156 build/C/man2/readdir.2:106
519 msgid "No such directory."
523 #: build/C/man2/getdents.2:156 build/C/man3/opendir.3:110 build/C/man2/readdir.2:106 build/C/man3/scandir.3:110 build/C/man3/scandirat.3:97
529 #: build/C/man2/getdents.2:159 build/C/man2/readdir.2:109
530 msgid "File descriptor does not refer to a directory."
533 #. SVr4 documents additional ENOLINK, EIO error conditions.
535 #: build/C/man2/getdents.2:162
540 #: build/C/man2/getdents.2:168
542 "Glibc does not provide a wrapper for this system call; call it using "
543 "B<syscall>(2). You will need to define the I<linux_dirent> structure "
548 #: build/C/man2/getdents.2:171
549 msgid "This call supersedes B<readdir>(2)."
553 #: build/C/man2/getdents.2:184
555 "The original Linux B<getdents>() system call did not handle large file "
556 "systems and large file offsets. Consequently, Linux 2.4 added "
557 "B<getdents64>(), with wider types for the I<d_ino> and I<d_off> fields "
558 "employed in the I<linux_dirent> structure."
562 #: build/C/man2/getdents.2:184 build/C/man3/scandir.3:148
567 #. FIXME: This program uses the older getdents(0 system call
568 #. and the structure with smaller field widths.
570 #: build/C/man2/getdents.2:191
572 "The program below demonstrates the use of B<getdents>(). The following "
573 "output shows an example of what we see when running this program on an ext2 "
578 #: build/C/man2/getdents.2:204
581 "$B< ./a.out /testfs/>\n"
582 "--------------- nread=120 ---------------\n"
583 "i-node# file type d_reclen d_off d_name\n"
584 " 2 directory 16 12 .\n"
585 " 2 directory 16 24 ..\n"
586 " 11 directory 24 44 lost+found\n"
587 " 12 regular 16 56 a\n"
588 " 228929 directory 16 68 sub\n"
589 " 16353 directory 16 80 sub2\n"
590 " 130817 directory 16 4096 sub3\n"
594 #: build/C/man2/getdents.2:206
596 msgid "Program source"
600 #: build/C/man2/getdents.2:217
603 "#define _GNU_SOURCE\n"
604 "#include E<lt>dirent.hE<gt> /* Defines DT_* constants */\n"
605 "#include E<lt>fcntl.hE<gt>\n"
606 "#include E<lt>stdio.hE<gt>\n"
607 "#include E<lt>unistd.hE<gt>\n"
608 "#include E<lt>stdlib.hE<gt>\n"
609 "#include E<lt>sys/stat.hE<gt>\n"
610 "#include E<lt>sys/syscall.hE<gt>\n"
614 #: build/C/man2/getdents.2:220
617 "#define handle_error(msg) \\e\n"
618 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
622 #: build/C/man2/getdents.2:227
625 "struct linux_dirent {\n"
628 " unsigned short d_reclen;\n"
634 #: build/C/man2/getdents.2:229
636 msgid "#define BUF_SIZE 1024\n"
640 #: build/C/man2/getdents.2:238
644 "main(int argc, char *argv[])\n"
647 " char buf[BUF_SIZE];\n"
648 " struct linux_dirent *d;\n"
654 #: build/C/man2/getdents.2:242
657 " fd = open(argc E<gt> 1 ? argv[1] : \".\", O_RDONLY | O_DIRECTORY);\n"
659 " handle_error(\"open\");\n"
663 #: build/C/man2/getdents.2:247
667 " nread = syscall(SYS_getdents, fd, buf, BUF_SIZE);\n"
668 " if (nread == -1)\n"
669 " handle_error(\"getdents\");\n"
673 #: build/C/man2/getdents.2:250
681 #: build/C/man2/getdents.2:269
684 " printf(\"--------------- nread=%d ---------------\\en\", nread);\n"
685 " printf(\"i-node# file type d_reclen d_off d_name\\en\");\n"
686 " for (bpos = 0; bpos E<lt> nread;) {\n"
687 " d = (struct linux_dirent *) (buf + bpos);\n"
688 " printf(\"%8ld \", d-E<gt>d_ino);\n"
689 " d_type = *(buf + bpos + d-E<gt>d_reclen - 1);\n"
690 " printf(\"%-10s \", (d_type == DT_REG) ? \"regular\" :\n"
691 " (d_type == DT_DIR) ? \"directory\" :\n"
692 " (d_type == DT_FIFO) ? \"FIFO\" :\n"
693 " (d_type == DT_SOCK) ? \"socket\" :\n"
694 " (d_type == DT_LNK) ? \"symlink\" :\n"
695 " (d_type == DT_BLK) ? \"block dev\" :\n"
696 " (d_type == DT_CHR) ? \"char dev\" : "
698 " printf(\"%4d %10lld %s\\en\", d-E<gt>d_reclen,\n"
699 " (long long) d-E<gt>d_off, (char *) d-E<gt>d_name);\n"
700 " bpos += d-E<gt>d_reclen;\n"
706 #: build/C/man2/getdents.2:272
709 " exit(EXIT_SUCCESS);\n"
714 #: build/C/man2/getdents.2:275
715 msgid "B<readdir>(2), B<readdir>(3)"
719 #: build/C/man3/getdirentries.3:27
721 msgid "GETDIRENTRIES"
725 #: build/C/man3/getdirentries.3:27
731 #: build/C/man3/getdirentries.3:27 build/C/man3/opendir.3:30 build/C/man3/scandir.3:34
737 #: build/C/man3/getdirentries.3:30
738 msgid "getdirentries - get directory entries in a file system-independent format"
742 #: build/C/man3/getdirentries.3:35
744 "B<ssize_t getdirentries(int >I<fd>B<, char *>I<buf>B<, size_t >I<nbytes> B<, "
745 "off_t *>I<basep>B<);>"
749 #: build/C/man3/getdirentries.3:43
750 msgid "B<getdirentries>(): _BSD_SOURCE || _SVID_SOURCE"
754 #: build/C/man3/getdirentries.3:56
756 "Read directory entries from the directory specified by I<fd> into I<buf>. "
757 "At most I<nbytes> are read. Reading starts at offset I<*basep>, and "
758 "I<*basep> is updated with the new position after reading."
762 #: build/C/man3/getdirentries.3:62
764 "B<getdirentries>() returns the number of bytes read or zero when at the end "
765 "of the directory. If an error occurs, -1 is returned, and I<errno> is set "
770 #: build/C/man3/getdirentries.3:64
771 msgid "See the Linux library source code for details."
775 #: build/C/man3/getdirentries.3:72
777 "Not in POSIX.1-2001. Present on the BSDs, and a few other systems. Use "
778 "B<opendir>(3) and B<readdir>(3) instead."
782 #: build/C/man3/getdirentries.3:74
783 msgid "B<lseek>(2), B<open>(2)"
787 #: build/C/man3/opendir.3:30
793 #: build/C/man3/opendir.3:30
799 #: build/C/man3/opendir.3:33
800 msgid "opendir, fdopendir - open a directory"
804 #: build/C/man3/opendir.3:41
807 "B<DIR *opendir(const char *>I<name>B<);>\n"
808 "B<DIR *fdopendir(int >I<fd>B<);>\n"
812 #: build/C/man3/opendir.3:49
813 msgid "B<fdopendir>():"
817 #: build/C/man3/opendir.3:52
819 msgid "Since glibc 2.10:"
823 #: build/C/man3/opendir.3:55
824 msgid "_XOPEN_SOURCE\\ E<gt>=\\ 700 || _POSIX_C_SOURCE\\ E<gt>=\\ 200809L"
828 #: build/C/man3/opendir.3:55
830 msgid "Before glibc 2.10:"
834 #: build/C/man3/opendir.3:58
839 #: build/C/man3/opendir.3:67
841 "The B<opendir>() function opens a directory stream corresponding to the "
842 "directory I<name>, and returns a pointer to the directory stream. The "
843 "stream is positioned at the first entry in the directory."
847 #: build/C/man3/opendir.3:81
849 "The B<fdopendir>() function is like B<opendir>(), but returns a directory "
850 "stream for the directory referred to by the open file descriptor I<fd>. "
851 "After a successful call to B<fdopendir>(), I<fd> is used internally by the "
852 "implementation, and should not otherwise be used by the application."
856 #: build/C/man3/opendir.3:90
858 "The B<opendir>() and B<fdopendir>() functions return a pointer to the "
859 "directory stream. On error, NULL is returned, and I<errno> is set "
864 #: build/C/man3/opendir.3:91
870 #: build/C/man3/opendir.3:94
871 msgid "Permission denied."
875 #: build/C/man3/opendir.3:98
876 msgid "I<fd> is not a valid file descriptor opened for reading."
880 #: build/C/man3/opendir.3:98
886 #: build/C/man3/opendir.3:101
887 msgid "Too many file descriptors in use by process."
891 #: build/C/man3/opendir.3:101
897 #: build/C/man3/opendir.3:104
898 msgid "Too many files are currently open in the system."
902 #: build/C/man3/opendir.3:107
903 msgid "Directory does not exist, or I<name> is an empty string."
907 #: build/C/man3/opendir.3:107 build/C/man3/scandir.3:107
913 #: build/C/man3/opendir.3:110 build/C/man3/scandir.3:110
914 msgid "Insufficient memory to complete the operation."
918 #: build/C/man3/opendir.3:113
919 msgid "I<name> is not a directory."
923 #: build/C/man3/opendir.3:113 build/C/man3/scandir.3:113 build/C/man3/scandirat.3:103
929 #: build/C/man3/opendir.3:116
930 msgid "B<fdopendir>() is available in glibc since version 2.4."
934 #: build/C/man3/opendir.3:121
936 "B<opendir>() is present on SVr4, 4.3BSD, and specified in POSIX.1-2001. "
937 "B<fdopendir>() is specified in POSIX.1-2008."
941 #: build/C/man3/opendir.3:124
943 "The underlying file descriptor of the directory stream can be obtained using "
948 #: build/C/man3/opendir.3:138
950 "The B<opendir>() function sets the close-on-exec flag for the file "
951 "descriptor underlying the I<DIR *>. The B<fdopendir>() function leaves the "
952 "setting of the close-on-exec flag unchanged for the file descriptor, I<fd>. "
953 "POSIX.1-200x leaves it unspecified whether a successful call to "
954 "B<fdopendir>() will set the close-on-exec flag for the file descriptor, "
959 #: build/C/man3/opendir.3:146
961 "B<open>(2), B<closedir>(3), B<dirfd>(3), B<readdir>(3), B<rewinddir>(3), "
962 "B<scandir>(3), B<seekdir>(3), B<telldir>(3)"
966 #: build/C/man2/readdir.2:28 build/C/man3/readdir.3:34
972 #: build/C/man2/readdir.2:28
978 #: build/C/man2/readdir.2:31
979 msgid "readdir - read directory entry"
983 #: build/C/man2/readdir.2:36
986 "B<int readdir(unsigned int >I<fd>B<, struct old_linux_dirent *>I<dirp>B<,>\n"
987 "B< unsigned int >I<count>B<);>\n"
991 #: build/C/man2/readdir.2:45
993 "This is not the function you are interested in. Look at B<readdir>(3) for "
994 "the POSIX conforming C library interface. This page documents the bare "
995 "kernel system call interface, which is superseded by B<getdents>(2)."
999 #: build/C/man2/readdir.2:59
1001 "B<readdir>() reads one I<old_linux_dirent> structure from the directory "
1002 "referred to by the file descriptor I<fd> into the buffer pointed to by "
1003 "I<dirp>. The argument I<count> is ignored; at most one I<old_linux_dirent> "
1004 "structure is read."
1008 #: build/C/man2/readdir.2:63
1009 msgid "The I<old_linux_dirent> structure is declared as follows:"
1013 #: build/C/man2/readdir.2:72
1016 "struct old_linux_dirent {\n"
1017 " long d_ino; /* inode number */\n"
1018 " off_t d_off; /* offset to this I<old_linux_dirent> */\n"
1019 " unsigned short d_reclen; /* length of this I<d_name> */\n"
1020 " char d_name[NAME_MAX+1]; /* filename (null-terminated) */\n"
1025 #: build/C/man2/readdir.2:86
1027 "I<d_ino> is an inode number. I<d_off> is the distance from the start of the "
1028 "directory to this I<old_linux_dirent>. I<d_reclen> is the size of "
1029 "I<d_name>, not counting the terminating null byte. I<d_name> is a "
1030 "null-terminated filename."
1034 #: build/C/man2/readdir.2:92
1036 "On success, 1 is returned. On end of directory, 0 is returned. On error, "
1037 "-1 is returned, and I<errno> is set appropriately."
1041 #: build/C/man2/readdir.2:111
1042 msgid "This system call is Linux-specific."
1046 #: build/C/man2/readdir.2:117
1048 "Glibc does not provide a wrapper for this system call; call it using "
1049 "B<syscall>(2). You will need to define the I<old_linux_dirent> structure "
1054 #: build/C/man2/readdir.2:119
1055 msgid "B<getdents>(2), B<readdir>(3)"
1059 #: build/C/man3/readdir.3:34
1065 #: build/C/man3/readdir.3:37
1066 msgid "readdir, readdir_r - read a directory"
1070 #: build/C/man3/readdir.3:42
1072 msgid "B<struct dirent *readdir(DIR *>I<dirp>B<);>\n"
1076 #: build/C/man3/readdir.3:45
1079 "B<int readdir_r(DIR *>I<dirp>B<, struct dirent *>I<entry>B<, struct dirent "
1080 "**>I<result>B<);>\n"
1084 #: build/C/man3/readdir.3:54
1085 msgid "B<readdir_r>():"
1089 #: build/C/man3/readdir.3:57
1091 "_POSIX_C_SOURCE\\ E<gt>=\\ 1 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE "
1096 #: build/C/man3/readdir.3:67
1098 "The B<readdir>() function returns a pointer to a I<dirent> structure "
1099 "representing the next directory entry in the directory stream pointed to by "
1100 "I<dirp>. It returns NULL on reaching the end of the directory stream or if "
1101 "an error occurred."
1105 #: build/C/man3/readdir.3:71
1106 msgid "On Linux, the I<dirent> structure is defined as follows:"
1110 #: build/C/man3/readdir.3:82
1114 " ino_t d_ino; /* inode number */\n"
1115 " off_t d_off; /* offset to the next dirent */\n"
1116 " unsigned short d_reclen; /* length of this record */\n"
1117 " unsigned char d_type; /* type of file; not supported\n"
1118 " by all file system types */\n"
1119 " char d_name[256]; /* filename */\n"
1124 #: build/C/man3/readdir.3:96
1126 "The only fields in the I<dirent> structure that are mandated by POSIX.1 are: "
1127 "I<d_name>[], of unspecified size, with at most B<NAME_MAX> characters "
1128 "preceding the terminating null byte; and (as an XSI extension) I<d_ino>. "
1129 "The other fields are unstandardized, and not present on all systems; see "
1130 "NOTES below for some further details."
1134 #: build/C/man3/readdir.3:102
1136 "The data returned by B<readdir>() may be overwritten by subsequent calls to "
1137 "B<readdir>() for the same directory stream."
1141 #: build/C/man3/readdir.3:117
1143 "The B<readdir_r>() function is a reentrant version of B<readdir>(). It "
1144 "reads the next directory entry from the directory stream I<dirp>, and "
1145 "returns it in the caller-allocated buffer pointed to by I<entry>. (See "
1146 "NOTES for information on allocating this buffer.) A pointer to the returned "
1147 "item is placed in I<*result>; if the end of the directory stream was "
1148 "encountered, then NULL is instead returned in I<*result>."
1152 #: build/C/man3/readdir.3:132
1154 "On success, B<readdir>() returns a pointer to a I<dirent> structure. (This "
1155 "structure may be statically allocated; do not attempt to B<free>(3) it.) "
1156 "If the end of the directory stream is reached, NULL is returned and I<errno> "
1157 "is not changed. If an error occurs, NULL is returned and I<errno> is set "
1162 #: build/C/man3/readdir.3:141
1164 "The B<readdir_r>() function returns 0 on success. On error, it returns a "
1165 "positive error number (listed under ERRORS). If the end of the directory "
1166 "stream is reached, B<readdir_r>() returns 0, and returns NULL in "
1171 #: build/C/man3/readdir.3:147 build/C/man3/rewinddir.3:51
1172 msgid "SVr4, 4.3BSD, POSIX.1-2001."
1176 #: build/C/man3/readdir.3:163
1178 "Only the fields I<d_name> and I<d_ino> are specified in POSIX.1-2001. The "
1179 "remaining fields are available on many, but not all systems. Under glibc, "
1180 "programs can check for the availability of the fields not defined in POSIX.1 "
1181 "by testing whether the macros B<_DIRENT_HAVE_D_NAMLEN>, "
1182 "B<_DIRENT_HAVE_D_RECLEN>, B<_DIRENT_HAVE_D_OFF>, or B<_DIRENT_HAVE_D_TYPE> "
1187 #: build/C/man3/readdir.3:176
1189 "Other than Linux, the I<d_type> field is available mainly only on BSD "
1190 "systems. This field makes it possible to avoid the expense of calling "
1191 "B<lstat>(2) if further actions depend on the type of the file. If the "
1192 "B<_BSD_SOURCE> feature test macro is defined, then glibc defines the "
1193 "following macro constants for the value returned in I<d_type>:"
1197 #: build/C/man3/readdir.3:207
1199 "If the file type could not be determined, the value B<DT_UNKNOWN> is "
1200 "returned in I<d_type>."
1204 #: build/C/man3/readdir.3:226
1206 "Since POSIX.1 does not specify the size of the I<d_name> field, and other "
1207 "nonstandard fields may precede that field within the I<dirent> structure, "
1208 "portable applications that use B<readdir_r>() should allocate the buffer "
1209 "whose address is passed in I<entry> as follows:"
1213 #: build/C/man3/readdir.3:232
1216 "len = offsetof(struct dirent, d_name) +\n"
1217 " pathconf(dirpath, _PC_NAME_MAX) + 1\n"
1218 "entryp = malloc(len);\n"
1222 #: build/C/man3/readdir.3:239
1223 msgid "(POSIX.1 requires that I<d_name> is the last field in a I<struct dirent>.)"
1227 #: build/C/man3/readdir.3:250
1229 "B<getdents>(2), B<read>(2), B<closedir>(3), B<dirfd>(3), B<ftw>(3), "
1230 "B<offsetof>(3), B<opendir>(3), B<rewinddir>(3), B<scandir>(3), "
1231 "B<seekdir>(3), B<telldir>(3)"
1235 #: build/C/man3/rewinddir.3:29
1241 #: build/C/man3/rewinddir.3:29
1247 #: build/C/man3/rewinddir.3:32
1248 msgid "rewinddir - reset directory stream"
1252 #: build/C/man3/rewinddir.3:39
1254 msgid "B<void rewinddir(DIR *>I<dirp>B<);>\n"
1258 #: build/C/man3/rewinddir.3:45
1260 "The B<rewinddir>() function resets the position of the directory stream "
1261 "I<dirp> to the beginning of the directory."
1265 #: build/C/man3/rewinddir.3:49
1266 msgid "The B<rewinddir>() function returns no value."
1270 #: build/C/man3/rewinddir.3:57
1272 "B<closedir>(3), B<opendir>(3), B<readdir>(3), B<scandir>(3), B<seekdir>(3), "
1277 #: build/C/man3/scandir.3:34
1283 #: build/C/man3/scandir.3:34
1289 #: build/C/man3/scandir.3:37
1290 msgid "scandir, alphasort, versionsort - scan a directory for matching entries"
1294 #: build/C/man3/scandir.3:42
1296 msgid "B<int scandir(const char *>I<dirp>B<, struct dirent ***>I<namelist>B<,>\n"
1300 #: build/C/man3/scandir.3:45 build/C/man3/scandirat.3:43
1303 "B<int (*>I<filter>B<)(const struct dirent *),>\n"
1304 "B<int (*>I<compar>B<)(const struct dirent **, const struct dirent **));>\n"
1308 #: build/C/man3/scandir.3:48
1310 msgid "B<int alphasort(const void *>I<a>B<, const void *>I<b>B<);>\n"
1314 #: build/C/man3/scandir.3:50
1316 msgid "B<int versionsort(const void *>I<a>B<, const void *>I<b>B<);>\n"
1320 #: build/C/man3/scandir.3:60
1321 msgid "B<scandir>(), B<alphasort>(): _BSD_SOURCE || _SVID_SOURCE"
1325 #: build/C/man3/scandir.3:63
1326 msgid "B<versionsort>(): _GNU_SOURCE"
1330 #: build/C/man3/scandir.3:78
1332 "The B<scandir>() function scans the directory I<dirp>, calling I<filter>() "
1333 "on each directory entry. Entries for which I<filter>() returns nonzero are "
1334 "stored in strings allocated via B<malloc>(3), sorted using B<qsort>(3) with "
1335 "the comparison function I<compar>(), and collected in array I<namelist> "
1336 "which is allocated via B<malloc>(3). If I<filter> is NULL, all entries are "
1341 #: build/C/man3/scandir.3:90
1343 "The B<alphasort>() and B<versionsort>() functions can be used as the "
1344 "comparison function I<compar>(). The former sorts directory entries using "
1345 "B<strcoll>(3), the latter using B<strverscmp>(3) on the strings "
1346 "I<(*a)-E<gt>d_name> and I<(*b)-E<gt>d_name>."
1350 #: build/C/man3/scandir.3:95
1352 "The B<scandir>() function returns the number of directory entries selected "
1353 "or -1 if an error occurs."
1357 #: build/C/man3/scandir.3:103
1359 "The B<alphasort>() and B<versionsort>() functions return an integer less "
1360 "than, equal to, or greater than zero if the first argument is considered to "
1361 "be respectively less than, equal to, or greater than the second."
1365 #: build/C/man3/scandir.3:107
1366 msgid "The path in I<dirp> does not exist."
1370 #: build/C/man3/scandir.3:113
1371 msgid "The path in I<dirp> is not a directory."
1375 #: build/C/man3/scandir.3:116
1376 msgid "B<versionsort>() was added to glibc in version 2.1."
1380 #: build/C/man3/scandir.3:123
1382 "B<alphasort>() and B<scandir>() are specified in POSIX.1-2008, and are "
1383 "widely available. B<versionsort>() is a GNU extension."
1387 #: build/C/man3/scandir.3:130
1389 "The functions B<scandir>() and B<alphasort>() are from 4.3BSD, and have "
1390 "been available under Linux since libc4. Libc4 and libc5 use the more "
1395 #: build/C/man3/scandir.3:134
1398 " int alphasort(const struct dirent ** a,\n"
1399 " const struct dirent **b);\n"
1403 #: build/C/man3/scandir.3:137
1404 msgid "but glibc 2.0 returns to the imprecise BSD prototype."
1408 #: build/C/man3/scandir.3:141
1410 "The function B<versionsort>() is a GNU extension, available since glibc "
1415 #: build/C/man3/scandir.3:148
1417 "Since glibc 2.1, B<alphasort>() calls B<strcoll>(3); earlier it used "
1422 #: build/C/man3/scandir.3:153
1425 "#define _SVID_SOURCE\n"
1426 "/* print files in current directory in reverse order */\n"
1427 "#include E<lt>dirent.hE<gt>\n"
1431 #: build/C/man3/scandir.3:159
1437 " struct dirent **namelist;\n"
1442 #: build/C/man3/scandir.3:171
1445 " n = scandir(\".\", &namelist, 0, alphasort);\n"
1447 " perror(\"scandir\");\n"
1450 " printf(\"%s\\en\", namelist[n]-E<gt>d_name);\n"
1451 " free(namelist[n]);\n"
1453 " free(namelist);\n"
1459 #: build/C/man3/scandir.3:183
1461 "B<closedir>(3), B<fnmatch>(3), B<opendir>(3), B<readdir>(3), "
1462 "B<rewinddir>(3), B<scandirat>(3), B<seekdir>(3), B<strcmp>(3), "
1463 "B<strcoll>(3), B<strverscmp>(3), B<telldir>(3)"
1467 #: build/C/man3/scandirat.3:26
1473 #: build/C/man3/scandirat.3:26
1479 #: build/C/man3/scandirat.3:29
1480 msgid "scandirat - scan a directory relative to a directory file descriptor"
1484 #: build/C/man3/scandirat.3:32
1486 msgid "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
1490 #: build/C/man3/scandirat.3:35
1493 "B<#include E<lt>fcntl.hE<gt>> /* Definition of AT_* constants */\n"
1494 "B<#include E<lt>dirent.hE<gt>>\n"
1498 #: build/C/man3/scandirat.3:39
1500 "B<int scandirat(int >I<dirfd>B<, const char *>I<dirp>B<,> B<struct dirent "
1501 "***>I<namelist>B<,>"
1505 #: build/C/man3/scandirat.3:51
1507 "The B<scandirat>() system call operates in exactly the same way as "
1508 "B<scandir>(3), except for the differences described in this manual page."
1512 #: build/C/man3/scandirat.3:61
1514 "If the pathname given in I<dirp> is relative, then it is interpreted "
1515 "relative to the directory referred to by the file descriptor I<dirfd> "
1516 "(rather than relative to the current working directory of the calling "
1517 "process, as is done by B<scandir>(3) for a relative pathname)."
1521 #: build/C/man3/scandirat.3:73
1523 "If I<dirp> is relative and I<dirfd> is the special value B<AT_FDCWD>, then "
1524 "I<dirp> is interpreted relative to the current working directory of the "
1525 "calling process (like B<scandir>(3))."
1529 #: build/C/man3/scandirat.3:79
1530 msgid "If I<dirp> is absolute, then I<dirfd> is ignored."
1534 #: build/C/man3/scandirat.3:86
1536 "On success, B<scandirat>() returns the number of directory entries "
1537 "selected. On error, -1 is returned and I<errno> is set to indicate the "
1542 #: build/C/man3/scandirat.3:93
1544 "The same errors that occur for B<scandir>(3) can also occur for "
1545 "B<scandirat>(). The following additional errors can occur for "
1550 #: build/C/man3/scandirat.3:97
1551 msgid "I<dirfd> is not a valid file descriptor."
1555 #: build/C/man3/scandirat.3:103
1557 "I<dirp> is a relative path and I<dirfd> is a file descriptor referring to a "
1558 "file other than a directory."
1562 #: build/C/man3/scandirat.3:106
1563 msgid "B<scandirat>() was added to glibc in version 2.15."
1567 #: build/C/man3/scandirat.3:108
1568 msgid "This function is a GNU extension."
1572 #: build/C/man3/scandirat.3:113
1573 msgid "See B<openat>(2) for an explanation of the need for B<scandirat>()."
1577 #: build/C/man3/scandirat.3:116
1578 msgid "B<openat>(2), B<scandir>(3), B<path_resolution>(7)"
1582 #: build/C/man3/seekdir.3:28
1588 #: build/C/man3/seekdir.3:28 build/C/man3/telldir.3:28
1594 #: build/C/man3/seekdir.3:32
1596 "seekdir - set the position of the next readdir() call in the directory "
1601 #: build/C/man3/seekdir.3:37
1603 msgid "B<void seekdir(DIR *>I<dirp>B<, long >I<offset>B<);>\n"
1607 #: build/C/man3/seekdir.3:46
1608 msgid "B<seekdir>(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE"
1612 #: build/C/man3/seekdir.3:58
1614 "The B<seekdir>() function sets the location in the directory stream from "
1615 "which the next B<readdir>(2) call will start. B<seekdir>() should be used "
1616 "with an I<offset> returned by B<telldir>(3)."
1620 #: build/C/man3/seekdir.3:62
1621 msgid "The B<seekdir>() function returns no value."
1625 #: build/C/man3/seekdir.3:64 build/C/man3/telldir.3:64
1626 msgid "4.3BSD, POSIX.1-2001."
1630 #: build/C/man3/seekdir.3:72
1632 "In glibc up to version 2.1.1, the type of the I<offset> argument was "
1633 "I<off_t>. POSIX.1-2001 specifies I<long>, and this is the type used since "
1638 #: build/C/man3/seekdir.3:79
1640 "B<lseek>(2), B<closedir>(3), B<opendir>(3), B<readdir>(3), B<rewinddir>(3), "
1641 "B<scandir>(3), B<telldir>(3)"
1645 #: build/C/man3/telldir.3:28
1651 #: build/C/man3/telldir.3:31
1652 msgid "telldir - return current location in directory stream"
1656 #: build/C/man3/telldir.3:36
1658 msgid "B<long telldir(DIR *>I<dirp>B<);>\n"
1662 #: build/C/man3/telldir.3:45
1663 msgid "B<telldir>(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE"
1667 #: build/C/man3/telldir.3:50
1669 "The B<telldir>() function returns the current location associated with the "
1670 "directory stream I<dirp>."
1674 #: build/C/man3/telldir.3:58
1676 "On success, the B<telldir>() function returns the current location in the "
1677 "directory stream. On error, -1 is returned, and I<errno> is set "
1682 #: build/C/man3/telldir.3:72
1684 "In glibc up to version 2.1.1, the return type of B<telldir>() was "
1685 "I<off_t>. POSIX.1-2001 specifies I<long>, and this is the type used since "
1690 #: build/C/man3/telldir.3:78
1692 "B<closedir>(3), B<opendir>(3), B<readdir>(3), B<rewinddir>(3), "
1693 "B<scandir>(3), B<seekdir>(3)"