1570af302Sopenharmony_ci#ifndef _DIRENT_H 2570af302Sopenharmony_ci#define _DIRENT_H 3570af302Sopenharmony_ci 4570af302Sopenharmony_ci#ifdef __cplusplus 5570af302Sopenharmony_ciextern "C" { 6570af302Sopenharmony_ci#endif 7570af302Sopenharmony_ci 8570af302Sopenharmony_ci#include <features.h> 9570af302Sopenharmony_ci 10570af302Sopenharmony_ci#define __NEED_ino_t 11570af302Sopenharmony_ci#define __NEED_off_t 12570af302Sopenharmony_ci#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) 13570af302Sopenharmony_ci#define __NEED_size_t 14570af302Sopenharmony_ci#endif 15570af302Sopenharmony_ci 16570af302Sopenharmony_ci#include <bits/alltypes.h> 17570af302Sopenharmony_ci 18570af302Sopenharmony_ci#include <bits/dirent.h> 19570af302Sopenharmony_ci 20570af302Sopenharmony_citypedef struct __dirstream DIR; 21570af302Sopenharmony_ci 22570af302Sopenharmony_ci#define d_fileno d_ino 23570af302Sopenharmony_ci 24570af302Sopenharmony_ciint closedir(DIR *); 25570af302Sopenharmony_ciDIR *fdopendir(int); 26570af302Sopenharmony_ciDIR *opendir(const char *); 27570af302Sopenharmony_cistruct dirent *readdir(DIR *); 28570af302Sopenharmony_ciint readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict); 29570af302Sopenharmony_civoid rewinddir(DIR *); 30570af302Sopenharmony_ciint dirfd(DIR *); 31570af302Sopenharmony_ci 32570af302Sopenharmony_ciint alphasort(const struct dirent **, const struct dirent **); 33570af302Sopenharmony_ciint scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **)); 34570af302Sopenharmony_ci 35570af302Sopenharmony_ci#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 36570af302Sopenharmony_civoid seekdir(DIR *, long); 37570af302Sopenharmony_cilong telldir(DIR *); 38570af302Sopenharmony_ci#endif 39570af302Sopenharmony_ci 40570af302Sopenharmony_ci#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 41570af302Sopenharmony_ci#define DT_UNKNOWN 0 42570af302Sopenharmony_ci#define DT_FIFO 1 43570af302Sopenharmony_ci#define DT_CHR 2 44570af302Sopenharmony_ci#define DT_DIR 4 45570af302Sopenharmony_ci#define DT_BLK 6 46570af302Sopenharmony_ci#define DT_REG 8 47570af302Sopenharmony_ci#define DT_LNK 10 48570af302Sopenharmony_ci#define DT_SOCK 12 49570af302Sopenharmony_ci#define DT_WHT 14 50570af302Sopenharmony_ci#define IFTODT(x) ((x)>>12 & 017) 51570af302Sopenharmony_ci#define DTTOIF(x) ((x)<<12) 52570af302Sopenharmony_ciint getdents(int, struct dirent *, size_t); 53570af302Sopenharmony_ci#endif 54570af302Sopenharmony_ci 55570af302Sopenharmony_ci#ifdef _GNU_SOURCE 56570af302Sopenharmony_ciint versionsort(const struct dirent **, const struct dirent **); 57570af302Sopenharmony_ci#endif 58570af302Sopenharmony_ci 59570af302Sopenharmony_ci#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) 60570af302Sopenharmony_ci#define dirent64 dirent 61570af302Sopenharmony_ci#define readdir64 readdir 62570af302Sopenharmony_ci#define readdir64_r readdir_r 63570af302Sopenharmony_ci#define scandir64 scandir 64570af302Sopenharmony_ci#define alphasort64 alphasort 65570af302Sopenharmony_ci#define versionsort64 versionsort 66570af302Sopenharmony_ci#define ino64_t ino_t 67570af302Sopenharmony_ci#define getdents64 getdents 68570af302Sopenharmony_ci#endif 69570af302Sopenharmony_ci 70570af302Sopenharmony_ci#ifdef __cplusplus 71570af302Sopenharmony_ci} 72570af302Sopenharmony_ci#endif 73570af302Sopenharmony_ci 74570af302Sopenharmony_ci#endif 75