]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/getdirentries.3
capabilities.7: Add pivot_root(2) to CAP_SYS_ADMIN list
[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 .B #include <dirent.h>
32 .PP
33 .BI "ssize_t getdirentries(int " fd ", char *" buf ", size_t " nbytes
34 .BI ", off_t *" basep );
35 .PP
36 .in -4n
37 Feature Test Macro Requirements for glibc (see
38 .BR feature_test_macros (7)):
39 .in
40 .PP
41 .BR getdirentries ():
42 Since glibc 2.19:
43 _DEFAULT_SOURCE
44 Glibc 2.19 and earlier:
45 _BSD_SOURCE || _SVID_SOURCE
46 .SH DESCRIPTION
47 Read directory entries from the directory specified by
48 .I fd
49 into
50 .IR buf .
51 At most
52 .I nbytes
53 are read.
54 Reading starts at offset
55 .IR *basep ,
56 and
57 .I *basep
58 is updated with the new position after reading.
59 .SH RETURN VALUE
60 .BR getdirentries ()
61 returns the number of bytes read or zero when at the end of the directory.
62 If an error occurs, \-1 is returned, and
63 .I errno
64 is set appropriately.
65 .SH ERRORS
66 See the Linux library source code for details.
67 .SH ATTRIBUTES
68 For an explanation of the terms used in this section, see
69 .BR attributes (7).
70 .TS
71 allbox;
72 lb lb lb
73 l l l.
74 Interface Attribute Value
75 T{
76 .BR getdirentries ()
77 T} Thread safety MT-Safe
78 .TE
79 .SH CONFORMING TO
80 Not in POSIX.1.
81 Present on the BSDs, and a few other systems.
82 Use
83 .BR opendir (3)
84 and
85 .BR readdir (3)
86 instead.
87 .SH SEE ALSO
88 .BR lseek (2),
89 .BR open (2)