Debian Codegraph @

templates/man2/getdents.2.pot

raw
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: 2026-06-05 06:25+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\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 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "getdents"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
28 #, no-wrap
29 msgid "2026-04-08"
30 msgstr ""
31
32 #. type: TH
33 #: archlinux debian-unstable
34 #, no-wrap
35 msgid "Linux man-pages 6.18"
36 msgstr ""
37
38 #. type: SH
39 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
40 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
41 #, no-wrap
42 msgid "NAME"
43 msgstr ""
44
45 #. type: Plain text
46 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
47 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
48 msgid "getdents, getdents64 - get directory entries"
49 msgstr ""
50
51 #. type: SH
52 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
53 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
54 #, no-wrap
55 msgid "LIBRARY"
56 msgstr ""
57
58 #. type: Plain text
59 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
60 #: opensuse-leap-16-1 opensuse-tumbleweed
61 msgid "Standard C library (I<libc>,\\ I<-lc>)"
62 msgstr ""
63
64 #. type: SH
65 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
66 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
67 #, no-wrap
68 msgid "SYNOPSIS"
69 msgstr ""
70
71 #. type: Plain text
72 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
73 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
74 #, no-wrap
75 msgid ""
76 "B<#include E<lt>sys/syscall.hE<gt>> /* Definition of B<SYS_*> constants */\n"
77 "B<#include E<lt>unistd.hE<gt>>\n"
78 msgstr ""
79
80 #. type: Plain text
81 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
82 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
83 #, no-wrap
84 msgid ""
85 "B<long syscall(SYS_getdents, unsigned int >I<fd>B<, struct linux_dirent *>I<dirp>B<,>\n"
86 "B< unsigned int >I<count>B<);>\n"
87 msgstr ""
88
89 #. type: Plain text
90 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
91 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
92 #, no-wrap
93 msgid ""
94 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
95 "B<#include E<lt>dirent.hE<gt>>\n"
96 msgstr ""
97
98 #. type: Plain text
99 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
100 #: opensuse-tumbleweed
101 #, no-wrap
102 msgid ""
103 "B<ssize_t getdents64(>size_t count;\n"
104 "B< int >I<fd>B<, void >I<dirp>B<[>I<count>B<], size_t >I<count>B<);>\n"
105 msgstr ""
106
107 #. type: Plain text
108 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
109 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
110 msgid ""
111 "I<Note>: glibc provides no wrapper for B<getdents>(), necessitating the use "
112 "of B<syscall>(2)."
113 msgstr ""
114
115 #. type: Plain text
116 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
117 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
118 msgid ""
119 "I<Note>: There is no definition of I<struct linux_dirent> in glibc; see "
120 "NOTES."
121 msgstr ""
122
123 #. type: SH
124 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
125 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
126 #, no-wrap
127 msgid "DESCRIPTION"
128 msgstr ""
129
130 #. type: Plain text
131 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
132 msgid ""
133 "These are not the interfaces you are interested in. Look at B<readdir>(3) "
134 "for the POSIX-conforming C library interface."
135 msgstr ""
136
137 #. type: SS
138 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
139 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
140 #, no-wrap
141 msgid "getdents()"
142 msgstr ""
143
144 #. type: Plain text
145 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
146 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
147 msgid ""
148 "The system call B<getdents>() reads several I<linux_dirent> structures from "
149 "the directory referred to by the open file descriptor I<fd> into the buffer "
150 "pointed to by I<dirp>. The argument I<count> specifies the size of that "
151 "buffer."
152 msgstr ""
153
154 #. type: Plain text
155 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
156 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
157 msgid "The I<linux_dirent> structure is declared as follows:"
158 msgstr ""
159
160 #. type: Plain text
161 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
162 #: opensuse-tumbleweed
163 #, no-wrap
164 msgid ""
165 "struct linux_dirent {\n"
166 " unsigned long d_ino; /* Inode number */\n"
167 " unsigned long d_off; /* Not an offset; see below */\n"
168 " unsigned short d_reclen; /* Length of this \\f[I]linux_dirent\\fR */\n"
169 " char d_name[]; /* Filename (null-terminated) */\n"
170 " /* length is actually (d_reclen - 2 -\n"
171 " offsetof(struct linux_dirent, d_name)) */\n"
172 " /*\n"
173 " char pad; // Zero padding byte\n"
174 " char d_type; // File type (only since Linux\n"
175 " // 2.6.4); offset is (d_reclen - 1)\n"
176 " */\n"
177 "}\n"
178 msgstr ""
179
180 #. type: Plain text
181 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
182 #: opensuse-leap-16-1 opensuse-tumbleweed
183 msgid ""
184 "I<d_ino> is an inode number. I<d_off> is a filesystem-specific value with "
185 "no specific meaning to user space, though on older filesystems it used to be "
186 "the distance from the start of the directory to the start of the next "
187 "I<linux_dirent>; see B<readdir>(3). I<d_reclen> is the size of this entire "
188 "I<linux_dirent>. I<d_name> is a null-terminated filename."
189 msgstr ""
190
191 #. type: Plain text
192 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
193 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
194 msgid ""
195 "I<d_type> is a byte at the end of the structure that indicates the file "
196 "type. It contains one of the following values (defined in "
197 "I<E<lt>dirent.hE<gt>>):"
198 msgstr ""
199
200 #. type: TP
201 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
202 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
203 #, no-wrap
204 msgid "B<DT_BLK>"
205 msgstr ""
206
207 #. type: Plain text
208 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
209 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
210 msgid "This is a block device."
211 msgstr ""
212
213 #. type: TP
214 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
215 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
216 #, no-wrap
217 msgid "B<DT_CHR>"
218 msgstr ""
219
220 #. type: Plain text
221 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
222 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
223 msgid "This is a character device."
224 msgstr ""
225
226 #. type: TP
227 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
228 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
229 #, no-wrap
230 msgid "B<DT_DIR>"
231 msgstr ""
232
233 #. type: Plain text
234 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
235 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
236 msgid "This is a directory."
237 msgstr ""
238
239 #. type: TP
240 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
241 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
242 #, no-wrap
243 msgid "B<DT_FIFO>"
244 msgstr ""
245
246 #. type: Plain text
247 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
248 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
249 msgid "This is a named pipe (FIFO)."
250 msgstr ""
251
252 #. type: TP
253 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
254 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
255 #, no-wrap
256 msgid "B<DT_LNK>"
257 msgstr ""
258
259 #. type: Plain text
260 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
261 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
262 msgid "This is a symbolic link."
263 msgstr ""
264
265 #. type: TP
266 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
267 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
268 #, no-wrap
269 msgid "B<DT_REG>"
270 msgstr ""
271
272 #. type: Plain text
273 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
274 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
275 msgid "This is a regular file."
276 msgstr ""
277
278 #. type: TP
279 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
280 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
281 #, no-wrap
282 msgid "B<DT_SOCK>"
283 msgstr ""
284
285 #. type: Plain text
286 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
287 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
288 msgid "This is a UNIX domain socket."
289 msgstr ""
290
291 #. type: TP
292 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
293 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
294 #, no-wrap
295 msgid "B<DT_UNKNOWN>"
296 msgstr ""
297
298 #. type: Plain text
299 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
300 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
301 msgid "The file type is unknown."
302 msgstr ""
303
304 #. type: Plain text
305 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
306 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
307 msgid ""
308 "The I<d_type> field is implemented since Linux 2.6.4. It occupies a space "
309 "that was previously a zero-filled padding byte in the I<linux_dirent> "
310 "structure. Thus, on kernels up to and including Linux 2.6.3, attempting to "
311 "access this field always provides the value 0 (B<DT_UNKNOWN>)."
312 msgstr ""
313
314 #. kernel 2.6.27
315 #. The same sentence is in readdir.2
316 #. type: Plain text
317 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
318 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
319 msgid ""
320 "Currently, only some filesystems (among them: Btrfs, ext2, ext3, and ext4) "
321 "have full support for returning the file type in I<d_type>. All "
322 "applications must properly handle a return of B<DT_UNKNOWN>."
323 msgstr ""
324
325 #. type: SS
326 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
327 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
328 #, no-wrap
329 msgid "getdents64()"
330 msgstr ""
331
332 #. type: Plain text
333 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
334 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
335 msgid ""
336 "The original Linux B<getdents>() system call did not handle large "
337 "filesystems and large file offsets. Consequently, Linux 2.4 added "
338 "B<getdents64>(), with wider types for the I<d_ino> and I<d_off> fields. In "
339 "addition, B<getdents64>() supports an explicit I<d_type> field."
340 msgstr ""
341
342 #. type: Plain text
343 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
344 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
345 msgid ""
346 "The B<getdents64>() system call is like B<getdents>(), except that its "
347 "second argument is a pointer to a buffer containing structures of the "
348 "following type:"
349 msgstr ""
350
351 #. type: Plain text
352 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
353 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
354 #, no-wrap
355 msgid ""
356 "struct linux_dirent64 {\n"
357 " ino64_t d_ino; /* 64-bit inode number */\n"
358 " off64_t d_off; /* Not an offset; see getdents() */\n"
359 " unsigned short d_reclen; /* Size of this dirent */\n"
360 " unsigned char d_type; /* File type */\n"
361 " char d_name[]; /* Filename (null-terminated) */\n"
362 "};\n"
363 msgstr ""
364
365 #. type: SH
366 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
367 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
368 #, no-wrap
369 msgid "RETURN VALUE"
370 msgstr ""
371
372 #. type: Plain text
373 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
374 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
375 msgid ""
376 "On success, the number of bytes read is returned. On end of directory, 0 is "
377 "returned. On error, -1 is returned, and I<errno> is set to indicate the "
378 "error."
379 msgstr ""
380
381 #. type: SH
382 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
383 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
384 #, no-wrap
385 msgid "ERRORS"
386 msgstr ""
387
388 #. type: TP
389 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
390 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
391 #, no-wrap
392 msgid "B<EBADF>"
393 msgstr ""
394
395 #. type: Plain text
396 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
397 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
398 msgid "Invalid file descriptor I<fd>."
399 msgstr ""
400
401 #. type: TP
402 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
403 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
404 #, no-wrap
405 msgid "B<EFAULT>"
406 msgstr ""
407
408 #. type: Plain text
409 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
410 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
411 msgid "Argument points outside the calling process's address space."
412 msgstr ""
413
414 #. type: TP
415 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
416 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
417 #, no-wrap
418 msgid "B<EINVAL>"
419 msgstr ""
420
421 #. type: Plain text
422 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
423 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
424 msgid "Result buffer is too small."
425 msgstr ""
426
427 #. type: TP
428 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
429 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
430 #, no-wrap
431 msgid "B<ENOENT>"
432 msgstr ""
433
434 #. type: Plain text
435 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
436 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
437 msgid "No such directory."
438 msgstr ""
439
440 #. type: TP
441 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
442 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
443 #, no-wrap
444 msgid "B<ENOTDIR>"
445 msgstr ""
446
447 #. type: Plain text
448 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
449 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
450 msgid "File descriptor does not refer to a directory."
451 msgstr ""
452
453 #. type: SH
454 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
455 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
456 #, no-wrap
457 msgid "STANDARDS"
458 msgstr ""
459
460 #. type: Plain text
461 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
462 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
463 msgid "None."
464 msgstr ""
465
466 #. type: SH
467 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
468 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
469 #, no-wrap
470 msgid "HISTORY"
471 msgstr ""
472
473 #. type: TP
474 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
475 #, no-wrap
476 msgid "B<getdents>()"
477 msgstr ""
478
479 #. SVr4 documents additional ENOLINK, EIO error conditions.
480 #. type: Plain text
481 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
482 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
483 msgid "SVr4."
484 msgstr ""
485
486 #. type: TP
487 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
488 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
489 #, no-wrap
490 msgid "B<getdents64>()"
491 msgstr ""
492
493 #. type: Plain text
494 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
495 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
496 msgid "glibc 2.30."
497 msgstr ""
498
499 #. type: SH
500 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
501 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
502 #, no-wrap
503 msgid "NOTES"
504 msgstr ""
505
506 #. type: Plain text
507 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
508 msgid ""
509 "glibc does not provide a wrapper for B<getdents>(); call B<getdents>() "
510 "using B<syscall>(2). In that case you will need to define the "
511 "I<linux_dirent> structure yourself."
512 msgstr ""
513
514 #. type: Plain text
515 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
516 msgid ""
517 "The B<getdents64>() system call accepts an B<unsigned int> argument "
518 "I<count> and assumes that I<count> does not exceed B<INT_MAX>. The glibc "
519 "wrapper function sets I<count> to B<INT_MAX> if it exceeds B<INT_MAX>. "
520 "glibc defines a I<dirent64> structure, which is similar to I<linux_dirent64> "
521 "but with a 256-byte I<d_name>."
522 msgstr ""
523
524 #. type: Plain text
525 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
526 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
527 msgid "Probably, you want to use B<readdir>(3) instead of these system calls."
528 msgstr ""
529
530 #. type: Plain text
531 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
532 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
533 msgid "These calls supersede B<readdir>(2)."
534 msgstr ""
535
536 #. type: SH
537 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
538 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
539 #, no-wrap
540 msgid "EXAMPLES"
541 msgstr ""
542
543 #. FIXME The example program needs to be revised, since it uses the older
544 #. getdents() system call and the structure with smaller field widths.
545 #. type: Plain text
546 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
547 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
548 msgid ""
549 "The program below demonstrates the use of B<getdents>(). The following "
550 "output shows an example of what we see when running this program on an ext2 "
551 "directory:"
552 msgstr ""
553
554 #. type: Plain text
555 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
556 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
557 #, no-wrap
558 msgid ""
559 "$B< ./a.out /testfs/>\n"
560 "--------------- nread=120 ---------------\n"
561 "inode# file type d_reclen d_off d_name\n"
562 " 2 directory 16 12 .\n"
563 " 2 directory 16 24 ..\n"
564 " 11 directory 24 44 lost+found\n"
565 " 12 regular 16 56 a\n"
566 " 228929 directory 16 68 sub\n"
567 " 16353 directory 16 80 sub2\n"
568 " 130817 directory 16 4096 sub3\n"
569 msgstr ""
570
571 #. type: SS
572 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
573 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
574 #, no-wrap
575 msgid "Program source"
576 msgstr ""
577
578 #. type: Plain text
579 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
580 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
581 #, no-wrap
582 msgid ""
583 "#define _GNU_SOURCE\n"
584 "#include E<lt>dirent.hE<gt> /* Defines DT_* constants */\n"
585 "#include E<lt>err.hE<gt>\n"
586 "#include E<lt>fcntl.hE<gt>\n"
587 "#include E<lt>stdint.hE<gt>\n"
588 "#include E<lt>stdio.hE<gt>\n"
589 "#include E<lt>stdlib.hE<gt>\n"
590 "#include E<lt>sys/syscall.hE<gt>\n"
591 "#include E<lt>sys/types.hE<gt>\n"
592 "#include E<lt>unistd.hE<gt>\n"
593 "\\&\n"
594 "struct linux_dirent {\n"
595 " unsigned long d_ino;\n"
596 " off_t d_off;\n"
597 " unsigned short d_reclen;\n"
598 " char d_name[];\n"
599 "};\n"
600 "\\&\n"
601 "#define BUF_SIZE 1024\n"
602 "\\&\n"
603 "int\n"
604 "main(int argc, char *argv[])\n"
605 "{\n"
606 " int fd;\n"
607 " char d_type;\n"
608 " char buf[BUF_SIZE];\n"
609 " long nread;\n"
610 " struct linux_dirent *d;\n"
611 "\\&\n"
612 " fd = open(argc E<gt> 1 ? argv[1] : \".\", O_RDONLY | O_DIRECTORY);\n"
613 " if (fd == -1)\n"
614 " err(EXIT_FAILURE, \"open\");\n"
615 "\\&\n"
616 " for (;;) {\n"
617 " nread = syscall(SYS_getdents, fd, buf, BUF_SIZE);\n"
618 " if (nread == -1)\n"
619 " err(EXIT_FAILURE, \"getdents\");\n"
620 "\\&\n"
621 " if (nread == 0)\n"
622 " break;\n"
623 "\\&\n"
624 " printf(\"--------------- nread=%ld ---------------\\[rs]n\", nread);\n"
625 " printf(\"inode# file type d_reclen d_off d_name\\[rs]n\");\n"
626 " for (size_t bpos = 0; bpos E<lt> nread;) {\n"
627 " d = (struct linux_dirent *) (buf + bpos);\n"
628 " printf(\"%8lu \", d-E<gt>d_ino);\n"
629 " d_type = *(buf + bpos + d-E<gt>d_reclen - 1);\n"
630 " printf(\"%-10s \", (d_type == DT_REG) ? \"regular\" :\n"
631 " (d_type == DT_DIR) ? \"directory\" :\n"
632 " (d_type == DT_FIFO) ? \"FIFO\" :\n"
633 " (d_type == DT_SOCK) ? \"socket\" :\n"
634 " (d_type == DT_LNK) ? \"symlink\" :\n"
635 " (d_type == DT_BLK) ? \"block dev\" :\n"
636 " (d_type == DT_CHR) ? \"char dev\" : \"???\");\n"
637 " printf(\"%4d %10jd %s\\[rs]n\", d-E<gt>d_reclen,\n"
638 " (intmax_t) d-E<gt>d_off, d-E<gt>d_name);\n"
639 " bpos += d-E<gt>d_reclen;\n"
640 " }\n"
641 " }\n"
642 "\\&\n"
643 " exit(EXIT_SUCCESS);\n"
644 "}\n"
645 msgstr ""
646
647 #. SRC END
648 #. type: SH
649 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
650 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
651 #, no-wrap
652 msgid "SEE ALSO"
653 msgstr ""
654
655 #. type: Plain text
656 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
657 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
658 msgid "B<readdir>(2), B<readdir>(3), B<inode>(7)"
659 msgstr ""
660
661 #. type: TH
662 #: debian-trixie
663 #, no-wrap
664 msgid "2024-06-15"
665 msgstr ""
666
667 #. type: TH
668 #: debian-trixie
669 #, no-wrap
670 msgid "Linux man-pages 6.9.1"
671 msgstr ""
672
673 #. type: Plain text
674 #: debian-trixie
675 msgid "Standard C library (I<libc>, I<-lc>)"
676 msgstr ""
677
678 #. type: Plain text
679 #: debian-trixie fedora-44 fedora-rawhide
680 #, no-wrap
681 msgid "B<ssize_t getdents64(int >I<fd>B<, void >I<dirp>B<[.>I<count>B<], size_t >I<count>B<);>\n"
682 msgstr ""
683
684 #. type: Plain text
685 #: debian-trixie fedora-44 fedora-rawhide mageia-cauldron
686 msgid ""
687 "These are not the interfaces you are interested in. Look at B<readdir>(3) "
688 "for the POSIX-conforming C library interface. This page documents the bare "
689 "kernel system call interfaces."
690 msgstr ""
691
692 #. type: Plain text
693 #: debian-trixie fedora-44 fedora-rawhide
694 #, no-wrap
695 msgid ""
696 "struct linux_dirent {\n"
697 " unsigned long d_ino; /* Inode number */\n"
698 " unsigned long d_off; /* Not an offset; see below */\n"
699 " unsigned short d_reclen; /* Length of this I<linux_dirent> */\n"
700 " char d_name[]; /* Filename (null-terminated) */\n"
701 " /* length is actually (d_reclen - 2 -\n"
702 " offsetof(struct linux_dirent, d_name)) */\n"
703 " /*\n"
704 " char pad; // Zero padding byte\n"
705 " char d_type; // File type (only since Linux\n"
706 " // 2.6.4); offset is (d_reclen - 1)\n"
707 " */\n"
708 "}\n"
709 msgstr ""
710
711 #. type: Plain text
712 #: debian-trixie
713 msgid ""
714 "I<d_ino> is an inode number. I<d_off> is a filesystem-specific value with "
715 "no specific meaning to user space, though on older filesystems it used to be "
716 "the distance from the start of the directory to the start of the next "
717 "I<linux_dirent>; see B<readdir>(3)B<.> I<d_reclen> is the size of this "
718 "entire I<linux_dirent>. I<d_name> is a null-terminated filename."
719 msgstr ""
720
721 #. type: Plain text
722 #: debian-trixie fedora-44 fedora-rawhide mageia-cauldron
723 msgid ""
724 "glibc does not provide a wrapper for B<getdents>(); call B<getdents>() "
725 "using B<syscall>(2). In that case you will need to define the "
726 "I<linux_dirent> or I<linux_dirent64> structure yourself."
727 msgstr ""
728
729 #. type: TH
730 #: fedora-44 fedora-rawhide
731 #, no-wrap
732 msgid "2024-11-17"
733 msgstr ""
734
735 #. type: TH
736 #: fedora-44 fedora-rawhide
737 #, no-wrap
738 msgid "Linux man-pages 6.13"
739 msgstr ""
740
741 #. type: TH
742 #: mageia-cauldron
743 #, no-wrap
744 msgid "2026-02-08"
745 msgstr ""
746
747 #. type: TH
748 #: mageia-cauldron
749 #, no-wrap
750 msgid "Linux man-pages 6.17"
751 msgstr ""
752
753 #. type: TH
754 #: opensuse-leap-16-1 opensuse-tumbleweed
755 #, no-wrap
756 msgid "Linux man-pages (unreleased)"
757 msgstr ""