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