move invariant netinet/in.h stuff out of bits/in.h
[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
11 #include <bits/alltypes.h>
12
13 typedef struct __DIR_s DIR;
14
15 struct dirent
16 {
17         ino_t d_ino;
18         off_t d_off;
19         unsigned short d_reclen;
20         unsigned char d_type;
21         char d_name[256];
22 };
23
24 #define d_fileno d_ino
25
26 int            closedir(DIR *);
27 DIR           *fdopendir(int);
28 DIR           *opendir(const char *);
29 struct dirent *readdir(DIR *);
30 int            readdir_r(DIR *, struct dirent *, struct dirent **);
31 void           rewinddir(DIR *);
32 void           seekdir(DIR *, long);
33 long           telldir(DIR *);
34 int            dirfd(DIR *);
35
36 int alphasort(const struct dirent **, const struct dirent **);
37 int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
38
39 #ifdef _GNU_SOURCE
40 #define DT_UNKNOWN 0
41 #define DT_FIFO 1
42 #define DT_CHR 2
43 #define DT_DIR 4
44 #define DT_BLK 6
45 #define DT_REG 8
46 #define DT_LNK 10
47 #define DT_SOCK 12
48 #define DT_WHT 14
49 #define IFTODT(x) ((x)>>12 & 017)
50 #define DTTOIF(x) ((x)<<12)
51 #endif
52
53 #ifdef __cplusplus
54 }
55 #endif
56
57 #endif