• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
13 #define __NEED_size_t
14 #endif
15 
16 #include <bits/alltypes.h>
17 
18 #include <bits/dirent.h>
19 
20 typedef struct __dirstream DIR;
21 
22 #define d_fileno d_ino
23 
24 int            closedir(DIR *);
25 DIR           *fdopendir(int);
26 DIR           *opendir(const char *);
27 struct dirent *readdir(DIR *);
28 int            readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict);
29 void           rewinddir(DIR *);
30 int            dirfd(DIR *);
31 
32 int alphasort(const struct dirent **, const struct dirent **);
33 int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
34 
35 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
36 void           seekdir(DIR *, long);
37 long           telldir(DIR *);
38 #endif
39 
40 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
41 #define DT_UNKNOWN 0
42 #define DT_FIFO 1
43 #define DT_CHR 2
44 #define DT_DIR 4
45 #define DT_BLK 6
46 #define DT_REG 8
47 #define DT_LNK 10
48 #define DT_SOCK 12
49 #define DT_WHT 14
50 #define IFTODT(x) ((x)>>12 & 017)
51 #define DTTOIF(x) ((x)<<12)
52 int getdents(int, struct dirent *, size_t);
53 #endif
54 
55 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
56 #define dirent64 dirent
57 #define readdir64 readdir
58 #define readdir64_r readdir_r
59 #define scandir64 scandir
60 #define alphasort64 alphasort
61 #define off64_t off_t
62 #define ino64_t ino_t
63 #define getdents64 getdents
64 #endif
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif
71