blob: 258f2d0791d2990c7a2ccff1dc80d0ba9d0a2e7f [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#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) internal_function;
20extern DIR *__fdopendir (int __fd);
21extern int __closedir (DIR *__dirp);
22extern struct dirent *__readdir (DIR *__dirp);
23extern struct dirent64 *__readdir64 (DIR *__dirp);
24extern int __readdir_r (DIR *__dirp, struct dirent *__entry,
25 struct dirent **__result);
26extern int __readdir64_r (DIR *__dirp, struct dirent64 *__entry,
27 struct dirent64 **__result);
28extern int __scandir64 (const char * __dir,
29 struct dirent64 *** __namelist,
30 int (*__selector) (const struct dirent64 *),
31 int (*__cmp) (const struct dirent64 **,
32 const struct dirent64 **));
33extern __ssize_t __getdirentries (int __fd, char *__restrict __buf,
34 size_t __nbytes,
35 __off_t *__restrict __basep)
36 __THROW __nonnull ((2, 4));
37extern __ssize_t __getdents (int __fd, char *__buf, size_t __nbytes)
38 internal_function;
39extern __ssize_t __getdents64 (int __fd, char *__buf, size_t __nbytes)
40 internal_function;
41extern int __alphasort64 (const struct dirent64 **a, const struct dirent64 **b)
42 __attribute_pure__;
43extern int __versionsort64 (const struct dirent64 **a,
44 const struct dirent64 **b)
45 __attribute_pure__;
46extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
47 const struct stat64 *statp)
48 internal_function;
49extern __typeof (rewinddir) __rewinddir;
50
51extern void __scandir_cancel_handler (void *arg) attribute_hidden;
52extern int __scandir_tail (DIR *dp,
53 struct dirent ***namelist,
54 int (*select) (const struct dirent *),
55 int (*cmp) (const struct dirent **,
56 const struct dirent **))
57 internal_function attribute_hidden;
58# ifdef _DIRENT_MATCHES_DIRENT64
59# define __scandir64_tail (dp, namelist, select, cmp) \
60 __scandir_tail (dp, (struct dirent ***) (namelist), \
61 (int (*) (const struct dirent *)) (select), \
62 (int (*) (const struct dirent **, \
63 const struct dirent **)) (cmp))
64# else
65extern int __scandir64_tail (DIR *dp,
66 struct dirent64 ***namelist,
67 int (*select) (const struct dirent64 *),
68 int (*cmp) (const struct dirent64 **,
69 const struct dirent64 **))
70 internal_function attribute_hidden;
71# endif
72
73libc_hidden_proto (__rewinddir)
74extern __typeof (scandirat) __scandirat;
75libc_hidden_proto (__scandirat)
76libc_hidden_proto (scandirat64)
77# endif
78
79#endif