dirent.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. struct scandir_cancel_struct
  10. {
  11. DIR *dp;
  12. void *v;
  13. size_t cnt;
  14. };
  15. /* Now define the internal interfaces. */
  16. extern DIR *__opendir (const char *__name) attribute_hidden;
  17. extern DIR *__opendirat (int dfd, const char *__name) attribute_hidden;
  18. extern DIR *__fdopendir (int __fd) attribute_hidden;
  19. extern int __closedir (DIR *__dirp) attribute_hidden;
  20. extern struct dirent *__readdir (DIR *__dirp) attribute_hidden;
  21. extern struct dirent64 *__readdir64 (DIR *__dirp);
  22. libc_hidden_proto (__readdir64)
  23. extern int __readdir_r (DIR *__dirp, struct dirent *__entry,
  24. struct dirent **__result);
  25. extern int __readdir64_r (DIR *__dirp, struct dirent64 *__entry,
  26. struct dirent64 **__result);
  27. extern int __scandir64 (const char * __dir,
  28. struct dirent64 *** __namelist,
  29. int (*__selector) (const struct dirent64 *),
  30. int (*__cmp) (const struct dirent64 **,
  31. const struct dirent64 **));
  32. extern __ssize_t __getdirentries (int __fd, char *__restrict __buf,
  33. size_t __nbytes,
  34. __off_t *__restrict __basep)
  35. __THROW __nonnull ((2, 4));
  36. extern __ssize_t __getdents (int __fd, char *__buf, size_t __nbytes)
  37. attribute_hidden;
  38. extern __ssize_t __getdents64 (int __fd, char *__buf, size_t __nbytes)
  39. attribute_hidden;
  40. extern int __alphasort64 (const struct dirent64 **a, const struct dirent64 **b)
  41. __attribute_pure__;
  42. extern int __versionsort64 (const struct dirent64 **a,
  43. const struct dirent64 **b)
  44. __attribute_pure__;
  45. extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
  46. const struct stat64 *statp) attribute_hidden;
  47. extern __typeof (rewinddir) __rewinddir;
  48. extern __typeof (seekdir) __seekdir;
  49. extern __typeof (dirfd) __dirfd;
  50. libc_hidden_proto (dirfd);
  51. extern void __scandir_cancel_handler (void *arg) attribute_hidden;
  52. extern 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. attribute_hidden;
  58. # if !_DIRENT_MATCHES_DIRENT64
  59. extern int __scandir_tail (DIR *dp,
  60. struct dirent ***namelist,
  61. int (*select) (const struct dirent *),
  62. int (*cmp) (const struct dirent **,
  63. const struct dirent **))
  64. attribute_hidden;
  65. # endif
  66. extern 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. attribute_hidden;
  72. libc_hidden_proto (__rewinddir)
  73. extern __typeof (scandirat) __scandirat;
  74. # if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
  75. extern __typeof (__rewinddir) __rewinddir attribute_hidden;
  76. # endif
  77. # endif
  78. #endif