3 # include <dirstream.h>
5 # include <dirent/dirent.h>
10 struct scandir_cancel_struct
17 /* Now define the internal interfaces. */
18 extern DIR *__opendir (const char *__name
) attribute_hidden
;
19 extern DIR *__opendirat (int dfd
, const char *__name
) attribute_hidden
;
20 extern DIR *__fdopendir (int __fd
) attribute_hidden
;
21 extern int __closedir (DIR *__dirp
) attribute_hidden
;
22 extern struct dirent
*__readdir (DIR *__dirp
) attribute_hidden
;
23 extern struct dirent
*__readdir_unlocked (DIR *__dirp
) attribute_hidden
;
24 extern struct dirent64
*__readdir64 (DIR *__dirp
);
25 libc_hidden_proto (__readdir64
)
26 extern int __readdir_r (DIR *__dirp
, struct dirent
*__entry
,
27 struct dirent
**__result
);
28 extern int __readdir64_r (DIR *__dirp
, struct dirent64
*__entry
,
29 struct dirent64
**__result
);
30 extern 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
**));
35 extern __ssize_t
__getdirentries (int __fd
, char *__restrict __buf
,
37 __off_t
*__restrict __basep
)
38 __THROW
__nonnull ((2, 4));
40 /* These functions are only implemented on Linux. */
41 extern __ssize_t
__getdents (int __fd
, void *__buf
, size_t __nbytes
)
43 extern __ssize_t
__getdents64 (int __fd
, void *__buf
, size_t __nbytes
);
44 libc_hidden_proto (__getdents64
)
46 extern int __alphasort64 (const struct dirent64
**a
, const struct dirent64
**b
)
48 extern int __versionsort64 (const struct dirent64
**a
,
49 const struct dirent64
**b
)
51 extern DIR *__alloc_dir (int fd
, bool close_fd
, int flags
,
52 const struct __stat64_t64
*statp
)
53 __nonnull (4) attribute_hidden
;
54 extern __typeof (rewinddir
) __rewinddir
;
55 extern __typeof (seekdir
) __seekdir
;
56 extern __typeof (dirfd
) __dirfd
;
57 libc_hidden_proto (dirfd
);
59 extern void __scandir_cancel_handler (void *arg
) attribute_hidden
;
60 extern 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
**))
66 # if !_DIRENT_MATCHES_DIRENT64
67 extern 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
**))
74 extern 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
**))
81 libc_hidden_proto (__rewinddir
)
82 extern __typeof (scandirat
) __scandirat
;
85 extern __typeof (__rewinddir
) __rewinddir attribute_hidden
;