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 dirent64 *__readdir64 (DIR *__dirp);
24libc_hidden_proto (__readdir64)
25extern int __readdir_r (DIR *__dirp, struct dirent *__entry,
26 struct dirent **__result);
27extern int __readdir64_r (DIR *__dirp, struct dirent64 *__entry,
28 struct dirent64 **__result);
29extern int __scandir64 (const char * __dir,
30 struct dirent64 *** __namelist,
31 int (*__selector) (const struct dirent64 *),
32 int (*__cmp) (const struct dirent64 **,
33 const struct dirent64 **));
34extern __ssize_t __getdirentries (int __fd, char *__restrict __buf,
35 size_t __nbytes,
36 __off_t *__restrict __basep)
37 __THROW __nonnull ((2, 4));
38
39/* These functions are only implemented on Linux. */
40extern __ssize_t __getdents (int __fd, void *__buf, size_t __nbytes)
41 attribute_hidden;
42extern __ssize_t __getdents64 (int __fd, void *__buf, size_t __nbytes);
43libc_hidden_proto (__getdents64)
44
45extern int __alphasort64 (const struct dirent64 **a, const struct dirent64 **b)
46 __attribute_pure__;
47extern int __versionsort64 (const struct dirent64 **a,
48 const struct dirent64 **b)
49 __attribute_pure__;
50extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
51 const struct stat64 *statp) attribute_hidden;
52extern __typeof (rewinddir) __rewinddir;
53extern __typeof (seekdir) __seekdir;
54extern __typeof (dirfd) __dirfd;
55libc_hidden_proto (dirfd);
56
57extern void __scandir_cancel_handler (void *arg) attribute_hidden;
58extern int __scandir_tail (DIR *dp,
59 struct dirent ***namelist,
60 int (*select) (const struct dirent *),
61 int (*cmp) (const struct dirent **,
62 const struct dirent **))
63 attribute_hidden;
64# if !_DIRENT_MATCHES_DIRENT64
65extern int __scandir_tail (DIR *dp,
66 struct dirent ***namelist,
67 int (*select) (const struct dirent *),
68 int (*cmp) (const struct dirent **,
69 const struct dirent **))
70 attribute_hidden;
71# endif
72extern int __scandir64_tail (DIR *dp,
73 struct dirent64 ***namelist,
74 int (*select) (const struct dirent64 *),
75 int (*cmp) (const struct dirent64 **,
76 const struct dirent64 **))
77 attribute_hidden;
78
79libc_hidden_proto (__rewinddir)
80extern __typeof (scandirat) __scandirat;
81
82# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
83extern __typeof (__rewinddir) __rewinddir attribute_hidden;
84# endif
85# endif
86
87#endif
88