dirent.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 dirent *__readdir_unlocked (DIR *__dirp) attribute_hidden;
  22. extern struct dirent64 *__readdir64 (DIR *__dirp);
  23. libc_hidden_proto (__readdir64)
  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. /* These functions are only implemented on Linux. */
  38. extern __ssize_t __getdents (int __fd, void *__buf, size_t __nbytes)
  39. attribute_hidden;
  40. extern __ssize_t __getdents64 (int __fd, void *__buf, size_t __nbytes);
  41. libc_hidden_proto (__getdents64)
  42. extern int __alphasort64 (const struct dirent64 **a, const struct dirent64 **b)
  43. __attribute_pure__;
  44. extern int __versionsort64 (const struct dirent64 **a,
  45. const struct dirent64 **b)
  46. __attribute_pure__;
  47. extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
  48. const struct __stat64_t64 *statp)
  49. __nonnull (4) attribute_hidden;
  50. extern __typeof (rewinddir) __rewinddir;
  51. extern __typeof (seekdir) __seekdir;
  52. extern __typeof (dirfd) __dirfd;
  53. libc_hidden_proto (dirfd);
  54. extern void __scandir_cancel_handler (void *arg) attribute_hidden;
  55. extern int __scandir_tail (DIR *dp,
  56. struct dirent ***namelist,
  57. int (*select) (const struct dirent *),
  58. int (*cmp) (const struct dirent **,
  59. const struct dirent **))
  60. attribute_hidden;
  61. # if !_DIRENT_MATCHES_DIRENT64
  62. extern int __scandir_tail (DIR *dp,
  63. struct dirent ***namelist,
  64. int (*select) (const struct dirent *),
  65. int (*cmp) (const struct dirent **,
  66. const struct dirent **))
  67. attribute_hidden;
  68. # endif
  69. extern int __scandir64_tail (DIR *dp,
  70. struct dirent64 ***namelist,
  71. int (*select) (const struct dirent64 *),
  72. int (*cmp) (const struct dirent64 **,
  73. const struct dirent64 **))
  74. attribute_hidden;
  75. libc_hidden_proto (__rewinddir)
  76. extern __typeof (scandirat) __scandirat;
  77. # if IS_IN (rtld)
  78. extern __typeof (__rewinddir) __rewinddir attribute_hidden;
  79. # endif
  80. # endif
  81. #endif