Debian Codegraph @

upstream/debian-unstable/man3/getdirentries.3

raw
1 '\" t
2 .\" Copyright 1993, Rickard E. Faith <[email protected]>
3 .\" Copyright 1991-1992, Free Software Foundation
4 .\" Copyright, the authors of the Linux man-pages project
5 .\"
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\"
8 .TH getdirentries 3 2026-02-08 "Linux man-pages 6.18"
9 .SH NAME
10 getdirentries \- get directory entries in a filesystem-independent format
11 .SH LIBRARY
12 Standard C library
13 .RI ( libc ,\~ \-lc )
14 .SH SYNOPSIS
15 .nf
16 .B #include <dirent.h>
17 .P
18 .BR "ssize_t getdirentries(" "size_t size;"
19 .BI " int " fd ", char " buf "[restrict " size "], size_t " size ,
20 .BI " off_t *restrict " basep );
21 .fi
22 .P
23 .RS -4
24 Feature Test Macro Requirements for glibc (see
25 .BR feature_test_macros (7)):
26 .RE
27 .P
28 .BR getdirentries ():
29 .nf
30 Since glibc 2.19:
31 _DEFAULT_SOURCE
32 glibc 2.19 and earlier:
33 _BSD_SOURCE || _SVID_SOURCE
34 .fi
35 .SH DESCRIPTION
36 Read directory entries from the directory specified by
37 .I fd
38 into
39 .IR buf .
40 At most
41 .I size
42 bytes are read.
43 Reading starts at offset
44 .IR *basep ,
45 and
46 .I *basep
47 is updated with the new position after reading.
48 .SH RETURN VALUE
49 .BR getdirentries ()
50 returns the number of bytes read or zero when at the end of the directory.
51 If an error occurs, \-1 is returned, and
52 .I errno
53 is set to indicate the error.
54 .SH ERRORS
55 See the Linux library source code for details.
56 .SH ATTRIBUTES
57 For an explanation of the terms used in this section, see
58 .BR attributes (7).
59 .TS
60 allbox;
61 lbx lb lb
62 l l l.
63 Interface Attribute Value
64 T{
65 .na
66 .nh
67 .BR getdirentries ()
68 T} Thread safety MT-Safe
69 .TE
70 .SH STANDARDS
71 BSD.
72 .SH NOTES
73 Use
74 .BR opendir (3)
75 and
76 .BR readdir (3)
77 instead.
78 .SH SEE ALSO
79 .BR lseek (2),
80 .BR open (2)