1 #ifndef _DIRENT_H 2 #define _DIRENT_H 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 #include <features.h> 9 10 #define __NEED_ino_t 11 #define __NEED_off_t 12 #define __NEED_size_t 13 #define __NEED_ssize_t 14 15 #include <bits/alltypes.h> 16 17 #include <bits/dirent.h> 18 19 typedef unsigned short reclen_t; 20 21 struct posix_dent { 22 ino_t d_ino; 23 off_t d_off; 24 reclen_t d_reclen; 25 unsigned char d_type; 26 char d_name[]; 27 }; 28 29 typedef struct __dirstream DIR; 30 31 #define d_fileno d_ino 32 33 int closedir(DIR *); 34 DIR *fdopendir(int); 35 DIR *opendir(const char *); 36 struct dirent *readdir(DIR *); 37 int readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict); 38 void rewinddir(DIR *); 39 int dirfd(DIR *); 40 41 ssize_t posix_getdents(int, void *, size_t, int); 42 43 int alphasort(const struct dirent **, const struct dirent **); 44 int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **)); 45 46 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 47 void seekdir(DIR *, long); 48 long telldir(DIR *); 49 #endif 50 51 #define DT_UNKNOWN 0 52 #define DT_FIFO 1 53 #define DT_CHR 2 54 #define DT_DIR 4 55 #define DT_BLK 6 56 #define DT_REG 8 57 #define DT_LNK 10 58 #define DT_SOCK 12 59 #define DT_WHT 14 60 61 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 62 #define IFTODT(x) ((x)>>12 & 017) 63 #define DTTOIF(x) ((x)<<12) 64 int getdents(int, struct dirent *, size_t); 65 #endif 66 67 #ifdef _GNU_SOURCE 68 int versionsort(const struct dirent **, const struct dirent **); 69 #endif 70 71 #if defined(_LARGEFILE64_SOURCE) 72 #define dirent64 dirent 73 #define readdir64 readdir 74 #define readdir64_r readdir_r 75 #define scandir64 scandir 76 #define alphasort64 alphasort 77 #define versionsort64 versionsort 78 #define off64_t off_t 79 #define ino64_t ino_t 80 #define getdents64 getdents 81 #endif 82 83 #ifdef __cplusplus 84 } 85 #endif 86 87 #endif 88