1#ifndef _DIRENT_H
2# ifndef _ISOMAC
3# include <dirstream.h>
4# endif
5# include <dirent/dirent.h>
6# ifndef _ISOMAC
7# include <sys/stat.h>
8# include <stdbool.h>
9
10struct scandir_cancel_struct
11{
12 DIR *dp;
13 void *v;
14 size_t cnt;
15};
16
17/* Now define the internal interfaces. */
18extern DIR *__opendir (const char *__name) attribute_hidden;
19extern DIR *__opendirat (int dfd, const char *__name) attribute_hidden;
20extern DIR *__fdopendir (int __fd) attribute_hidden;
21extern int __closedir (DIR *__dirp) attribute_hidden;
22extern struct dirent *__readdir (DIR *__dirp) attribute_hidden;
23extern struct dirent *__readdir_unlocked (DIR *__dirp) attribute_hidden;
24extern struct dirent64 *__readdir64 (DIR *__dirp);
25libc_hidden_proto (__readdir64)
26extern int __readdir_r (DIR *__dirp, struct dirent *__entry,
27 struct dirent **__result);
28extern int __readdir64_r (DIR *__dirp, struct dirent64 *__entry,
29 struct dirent64 **__result);
30extern int __scandir64 (const char * __dir,
31 struct dirent64 *** __namelist,
32 int (*__selector) (const struct dirent64 *),
33 int (*__cmp) (const struct dirent64 **,
34 const struct dirent64 **));
35extern __ssize_t __getdirentries (int __fd, char *__restrict __buf,
36 size_t __nbytes,
37 __off_t *__restrict __basep)
38 __THROW __nonnull ((2, 4));
39
40/* These functions are only implemented on Linux. */
41extern __ssize_t __getdents (int __fd, void *__buf, size_t __nbytes)
42 attribute_hidden;
43extern __ssize_t __getdents64 (int __fd, void *__buf, size_t __nbytes);
44libc_hidden_proto (__getdents64)
45
46extern int __alphasort64 (const struct dirent64 **a, const struct dirent64 **b)
47 __attribute_pure__;
48extern int __versionsort64 (const struct dirent64 **a,
49 const struct dirent64 **b)
50 __attribute_pure__;
51extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
52 const struct __stat64_t64 *statp)
53 __nonnull (4) attribute_hidden;
54extern __typeof (rewinddir) __rewinddir;
55extern __typeof (seekdir) __seekdir;
56extern __typeof (dirfd) __dirfd;
57libc_hidden_proto (dirfd);
58
59extern void __scandir_cancel_handler (void *arg) attribute_hidden;
60extern int __scandir_tail (DIR *dp,
61 struct dirent ***namelist,
62 int (*select) (const struct dirent *),
63 int (*cmp) (const struct dirent **,
64 const struct dirent **))
65 attribute_hidden;
66# if !_DIRENT_MATCHES_DIRENT64
67extern int __scandir_tail (DIR *dp,
68 struct dirent ***namelist,
69 int (*select) (const struct dirent *),
70 int (*cmp) (const struct dirent **,
71 const struct dirent **))
72 attribute_hidden;
73# endif
74extern int __scandir64_tail (DIR *dp,
75 struct dirent64 ***namelist,
76 int (*select) (const struct dirent64 *),
77 int (*cmp) (const struct dirent64 **,
78 const struct dirent64 **))
79 attribute_hidden;
80
81libc_hidden_proto (__rewinddir)
82extern __typeof (scandirat) __scandirat;
83
84# if IS_IN (rtld)
85extern __typeof (__rewinddir) __rewinddir attribute_hidden;
86# endif
87# endif
88
89#endif
90

source code of glibc/include/dirent.h