a98062948b4cae7b7fed4a421f47039b03ae4cb8
[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[1];
22 };
23
24 int            closedir(DIR *);
25 DIR           *fdopendir(int);
26 DIR           *opendir(const char *);
27 struct dirent *readdir(DIR *);
28 int            readdir_r(DIR *, struct dirent *, struct dirent **);
29 void           rewinddir(DIR *);
30 void           seekdir(DIR *, long);
31 long           telldir(DIR *);
32 int            dirfd(DIR *);
33
34 int alphasort(const struct dirent **, const struct dirent **);
35 int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
36
37 #ifdef _GNU_SOURCE
38 #define DT_UNKNOWN 0
39 #define DT_FIFO 1
40 #define DT_CHR 2
41 #define DT_DIR 4
42 #define DT_BLK 6
43 #define DT_REG 8
44 #define DT_LNK 10
45 #define DT_SOCK 12
46 #define DT_WHT 14
47 #define IFTODT(x) ((x)>>12 & 017)
48 #define DTTOIF(x) ((x)<<12)
49 #endf
50
51 #ifdef __cplusplus
52 extern }
53 #endif
54
55 #endif