]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) |
2 | .\" Portions extracted from /usr/include/dirent.h are: | |
3 | .\" Copyright 1991, 1992 Free Software Foundation | |
4 | .\" | |
5fbde956 | 5 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da | 6 | .\" |
45186a5d | 7 | .TH GETDIRENTRIES 3 2021-03-22 "Linux man-pages (unreleased)" |
fea681da | 8 | .SH NAME |
9ee4a2b6 | 9 | getdirentries \- get directory entries in a filesystem-independent format |
42009080 AC |
10 | .SH LIBRARY |
11 | Standard C library | |
12 | .RI ( libc ", " \-lc ) | |
fea681da | 13 | .SH SYNOPSIS |
7b5d39f4 | 14 | .nf |
fea681da | 15 | .B #include <dirent.h> |
68e4db0a | 16 | .PP |
934e5162 AC |
17 | .BI "ssize_t getdirentries(int " fd ", char *restrict " buf ", size_t " nbytes , |
18 | .BI " off_t *restrict " basep ); | |
7b5d39f4 | 19 | .fi |
68e4db0a | 20 | .PP |
d39ad78f | 21 | .RS -4 |
cc4615cc MK |
22 | Feature Test Macro Requirements for glibc (see |
23 | .BR feature_test_macros (7)): | |
d39ad78f | 24 | .RE |
68e4db0a | 25 | .PP |
cc4615cc | 26 | .BR getdirentries (): |
9d281e06 | 27 | .nf |
51c612fb MK |
28 | Since glibc 2.19: |
29 | _DEFAULT_SOURCE | |
30 | Glibc 2.19 and earlier: | |
31 | _BSD_SOURCE || _SVID_SOURCE | |
9d281e06 | 32 | .fi |
fea681da MK |
33 | .SH DESCRIPTION |
34 | Read directory entries from the directory specified by | |
35 | .I fd | |
36 | into | |
37 | .IR buf . | |
38 | At most | |
39 | .I nbytes | |
c13182ef MK |
40 | are read. |
41 | Reading starts at offset | |
bd9b2a9c | 42 | .IR *basep , |
fea681da | 43 | and |
bd9b2a9c | 44 | .I *basep |
fea681da | 45 | is updated with the new position after reading. |
47297adb | 46 | .SH RETURN VALUE |
e511ffb6 | 47 | .BR getdirentries () |
fea681da MK |
48 | returns the number of bytes read or zero when at the end of the directory. |
49 | If an error occurs, \-1 is returned, and | |
50 | .I errno | |
f6a4078b | 51 | is set to indicate the error. |
fea681da MK |
52 | .SH ERRORS |
53 | See the Linux library source code for details. | |
6a404085 | 54 | .SH ATTRIBUTES |
8b01d0ee MK |
55 | For an explanation of the terms used in this section, see |
56 | .BR attributes (7). | |
c466875e MK |
57 | .ad l |
58 | .nh | |
8b01d0ee MK |
59 | .TS |
60 | allbox; | |
c466875e | 61 | lbx lb lb |
8b01d0ee MK |
62 | l l l. |
63 | Interface Attribute Value | |
64 | T{ | |
6a404085 | 65 | .BR getdirentries () |
8b01d0ee MK |
66 | T} Thread safety MT-Safe |
67 | .TE | |
c466875e MK |
68 | .hy |
69 | .ad | |
70 | .sp 1 | |
3113c7f3 | 71 | .SH STANDARDS |
3b89d4bf | 72 | Not in POSIX.1. |
c13182ef | 73 | Present on the BSDs, and a few other systems. |
a7fadb55 MK |
74 | Use |
75 | .BR opendir (3) | |
c13182ef | 76 | and |
a7fadb55 MK |
77 | .BR readdir (3) |
78 | instead. | |
47297adb | 79 | .SH SEE ALSO |
fea681da | 80 | .BR lseek (2), |
cc4615cc | 81 | .BR open (2) |