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);
19extern DIR *__opendirat (int dfd, const char *__name)
20 internal_function attribute_hidden;
21extern DIR *__fdopendir (int __fd);
22extern int __closedir (DIR *__dirp);
23extern struct dirent *__readdir (DIR *__dirp);
24extern struct dirent64 *__readdir64 (DIR *__dirp);
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));
38extern __ssize_t __getdents (int __fd, char *__buf, size_t __nbytes)
39 internal_function attribute_hidden;
40extern __ssize_t __getdents64 (int __fd, char *__buf, size_t __nbytes)
41 internal_function attribute_hidden;
42extern int __alphasort64 (const struct dirent64 **a, const struct dirent64 **b)
43 __attribute_pure__;
44extern int __versionsort64 (const struct dirent64 **a,
45 const struct dirent64 **b)
46 __attribute_pure__;
47extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
48 const struct stat64 *statp)
49 internal_function attribute_hidden;
50extern __typeof (rewinddir) __rewinddir;
51
52extern void __scandir_cancel_handler (void *arg) attribute_hidden;
53extern int __scandir_tail (DIR *dp,
54 struct dirent ***namelist,
55 int (*select) (const struct dirent *),
56 int (*cmp) (const struct dirent **,
57 const struct dirent **))
58 internal_function attribute_hidden;
59# ifdef _DIRENT_MATCHES_DIRENT64
60# define __scandir64_tail (dp, namelist, select, cmp) \
61 __scandir_tail (dp, (struct dirent ***) (namelist), \
62 (int (*) (const struct dirent *)) (select), \
63 (int (*) (const struct dirent **, \
64 const struct dirent **)) (cmp))
65# else
66extern int __scandir64_tail (DIR *dp,
67 struct dirent64 ***namelist,
68 int (*select) (const struct dirent64 *),
69 int (*cmp) (const struct dirent64 **,
70 const struct dirent64 **))
71 internal_function attribute_hidden;
72# endif
73
74libc_hidden_proto (__rewinddir)
75extern __typeof (scandirat) __scandirat;
76libc_hidden_proto (__scandirat)
77libc_hidden_proto (scandirat64)
78
79# if IS_IN (rtld)
80extern __typeof (__closedir) __closedir attribute_hidden;
81extern __typeof (__fdopendir) __fdopendir attribute_hidden;
82extern __typeof (__readdir) __readdir attribute_hidden;
83extern __typeof (__readdir64) __readdir64 attribute_hidden;
84extern __typeof (__rewinddir) __rewinddir attribute_hidden;
85# endif
86# endif
87
88#endif
89