1
0

dirent.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef _DIRENT_H
  2. #define _DIRENT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #define __NEED_ino_t
  7. #define __NEED_off_t
  8. #include <bits/alltypes.h>
  9. typedef struct __DIR_s DIR;
  10. struct dirent
  11. {
  12. ino_t d_ino;
  13. off_t d_off;
  14. unsigned short d_reclen;
  15. unsigned char d_type;
  16. char d_name[256];
  17. };
  18. #define d_fileno d_ino
  19. int closedir(DIR *);
  20. DIR *fdopendir(int);
  21. DIR *opendir(const char *);
  22. struct dirent *readdir(DIR *);
  23. int readdir_r(DIR *, struct dirent *, struct dirent **);
  24. void rewinddir(DIR *);
  25. void seekdir(DIR *, long);
  26. long telldir(DIR *);
  27. int dirfd(DIR *);
  28. int alphasort(const struct dirent **, const struct dirent **);
  29. int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
  30. #ifdef _GNU_SOURCE
  31. #define DT_UNKNOWN 0
  32. #define DT_FIFO 1
  33. #define DT_CHR 2
  34. #define DT_DIR 4
  35. #define DT_BLK 6
  36. #define DT_REG 8
  37. #define DT_LNK 10
  38. #define DT_SOCK 12
  39. #define DT_WHT 14
  40. #define IFTODT(x) ((x)>>12 & 017)
  41. #define DTTOIF(x) ((x)<<12)
  42. #endif
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46. #endif