]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/getdirentries.3
Various pages: Standardize wording around setting of 'errno' on error
[thirdparty/man-pages.git] / man3 / getdirentries.3
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 .\"
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .TH GETDIRENTRIES 3 2016-03-15 "GNU" "Linux Programmer's Manual"
28 .SH NAME
29 getdirentries \- get directory entries in a filesystem-independent format
30 .SH SYNOPSIS
31 .nf
32 .B #include <dirent.h>
33 .PP
34 .BI "ssize_t getdirentries(int " fd ", char *" buf ", size_t " nbytes ,
35 .BI " off_t *" basep );
36 .fi
37 .PP
38 .RS -4
39 Feature Test Macro Requirements for glibc (see
40 .BR feature_test_macros (7)):
41 .RE
42 .PP
43 .BR getdirentries ():
44 .nf
45 Since glibc 2.19:
46 _DEFAULT_SOURCE
47 Glibc 2.19 and earlier:
48 _BSD_SOURCE || _SVID_SOURCE
49 .fi
50 .SH DESCRIPTION
51 Read directory entries from the directory specified by
52 .I fd
53 into
54 .IR buf .
55 At most
56 .I nbytes
57 are read.
58 Reading starts at offset
59 .IR *basep ,
60 and
61 .I *basep
62 is updated with the new position after reading.
63 .SH RETURN VALUE
64 .BR getdirentries ()
65 returns the number of bytes read or zero when at the end of the directory.
66 If an error occurs, \-1 is returned, and
67 .I errno
68 is set to indicate the error.
69 .SH ERRORS
70 See the Linux library source code for details.
71 .SH ATTRIBUTES
72 For an explanation of the terms used in this section, see
73 .BR attributes (7).
74 .ad l
75 .nh
76 .TS
77 allbox;
78 lbx lb lb
79 l l l.
80 Interface Attribute Value
81 T{
82 .BR getdirentries ()
83 T} Thread safety MT-Safe
84 .TE
85 .hy
86 .ad
87 .sp 1
88 .SH CONFORMING TO
89 Not in POSIX.1.
90 Present on the BSDs, and a few other systems.
91 Use
92 .BR opendir (3)
93 and
94 .BR readdir (3)
95 instead.
96 .SH SEE ALSO
97 .BR lseek (2),
98 .BR open (2)