dirent.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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[1];
  17. };
  18. int closedir(DIR *);
  19. DIR *fdopendir(int);
  20. DIR *opendir(const char *);
  21. struct dirent *readdir(DIR *);
  22. int readdir_r(DIR *, struct dirent *, struct dirent **);
  23. void rewinddir(DIR *);
  24. void seekdir(DIR *, long);
  25. long telldir(DIR *);
  26. int dirfd(DIR *);
  27. int alphasort(const struct dirent **, const struct dirent **);
  28. int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
  29. #ifdef _GNU_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. #endif
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45. #endif