dirent.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef _DIRENT_H
  2. #define _DIRENT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <features.h>
  7. #define __NEED_ino_t
  8. #define __NEED_off_t
  9. #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
  10. #define __NEED_size_t
  11. #endif
  12. #include <bits/alltypes.h>
  13. #include <bits/dirent.h>
  14. typedef struct __dirstream DIR;
  15. #define d_fileno d_ino
  16. int closedir(DIR *);
  17. DIR *fdopendir(int);
  18. DIR *opendir(const char *);
  19. struct dirent *readdir(DIR *);
  20. int readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict);
  21. void rewinddir(DIR *);
  22. int dirfd(DIR *);
  23. int alphasort(const struct dirent **, const struct dirent **);
  24. int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
  25. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  26. void seekdir(DIR *, long);
  27. long telldir(DIR *);
  28. #endif
  29. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  30. #define DT_UNKNOWN 0
  31. #define DT_FIFO 1
  32. #define DT_CHR 2
  33. #define DT_DIR 4
  34. #define DT_BLK 6
  35. #define DT_REG 8
  36. #define DT_LNK 10
  37. #define DT_SOCK 12
  38. #define DT_WHT 14
  39. #define IFTODT(x) ((x)>>12 & 017)
  40. #define DTTOIF(x) ((x)<<12)
  41. int getdents(int, struct dirent *, size_t);
  42. #endif
  43. #ifdef _GNU_SOURCE
  44. int versionsort(const struct dirent **, const struct dirent **);
  45. #endif
  46. #if defined(_LARGEFILE64_SOURCE)
  47. #define dirent64 dirent
  48. #define readdir64 readdir
  49. #define readdir64_r readdir_r
  50. #define scandir64 scandir
  51. #define alphasort64 alphasort
  52. #define versionsort64 versionsort
  53. #define off64_t off_t
  54. #define ino64_t ino_t
  55. #define getdents64 getdents
  56. #endif
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #endif