posix: Sync glob with gnulib [BZ #1062]
[glibc.git] / include / dirent.h
blobbebcd52cdb569b6f7e44159a2774788918eeb719
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>
10 struct scandir_cancel_struct
12 DIR *dp;
13 void *v;
14 size_t cnt;
17 /* Now define the internal interfaces. */
18 extern DIR *__opendir (const char *__name);
19 extern DIR *__opendirat (int dfd, const char *__name) attribute_hidden;
20 extern DIR *__fdopendir (int __fd);
21 extern int __closedir (DIR *__dirp);
22 extern struct dirent *__readdir (DIR *__dirp);
23 extern struct dirent64 *__readdir64 (DIR *__dirp);
24 extern int __readdir_r (DIR *__dirp, struct dirent *__entry,
25 struct dirent **__result);
26 extern int __readdir64_r (DIR *__dirp, struct dirent64 *__entry,
27 struct dirent64 **__result);
28 extern 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 **));
33 extern __ssize_t __getdirentries (int __fd, char *__restrict __buf,
34 size_t __nbytes,
35 __off_t *__restrict __basep)
36 __THROW __nonnull ((2, 4));
37 extern __ssize_t __getdents (int __fd, char *__buf, size_t __nbytes)
38 attribute_hidden;
39 extern __ssize_t __getdents64 (int __fd, char *__buf, size_t __nbytes)
40 attribute_hidden;
41 extern int __alphasort64 (const struct dirent64 **a, const struct dirent64 **b)
42 __attribute_pure__;
43 extern int __versionsort64 (const struct dirent64 **a,
44 const struct dirent64 **b)
45 __attribute_pure__;
46 extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
47 const struct stat64 *statp) attribute_hidden;
48 extern __typeof (rewinddir) __rewinddir;
50 extern void __scandir_cancel_handler (void *arg) attribute_hidden;
51 extern int __scandir_tail (DIR *dp,
52 struct dirent ***namelist,
53 int (*select) (const struct dirent *),
54 int (*cmp) (const struct dirent **,
55 const struct dirent **))
56 attribute_hidden;
57 # ifdef _DIRENT_MATCHES_DIRENT64
58 # define __scandir64_tail (dp, namelist, select, cmp) \
59 __scandir_tail (dp, (struct dirent ***) (namelist), \
60 (int (*) (const struct dirent *)) (select), \
61 (int (*) (const struct dirent **, \
62 const struct dirent **)) (cmp))
63 # else
64 extern int __scandir64_tail (DIR *dp,
65 struct dirent64 ***namelist,
66 int (*select) (const struct dirent64 *),
67 int (*cmp) (const struct dirent64 **,
68 const struct dirent64 **))
69 attribute_hidden;
70 # endif
72 libc_hidden_proto (__rewinddir)
73 extern __typeof (scandirat) __scandirat;
74 libc_hidden_proto (__scandirat)
75 libc_hidden_proto (scandirat64)
77 # if IS_IN (rtld)
78 extern __typeof (__closedir) __closedir attribute_hidden;
79 extern __typeof (__fdopendir) __fdopendir attribute_hidden;
80 extern __typeof (__readdir) __readdir attribute_hidden;
81 extern __typeof (__readdir64) __readdir64 attribute_hidden;
82 extern __typeof (__rewinddir) __rewinddir attribute_hidden;
83 # endif
84 # endif
86 #endif