fix FFSYNC by changing it to O_SYNC
[oweals/musl.git] / include / dirent.h
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 typedef struct __dirstream DIR;
19
20 struct dirent {
21         ino_t d_ino;
22         off_t d_off;
23         unsigned short d_reclen;
24         unsigned char d_type;
25         char d_name[256];
26 };
27
28 #define d_fileno d_ino
29
30 int            closedir(DIR *);
31 DIR           *fdopendir(int);
32 DIR           *opendir(const char *);
33 struct dirent *readdir(DIR *);
34 int            readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict);
35 void           rewinddir(DIR *);
36 void           seekdir(DIR *, long);
37 long           telldir(DIR *);
38 int            dirfd(DIR *);
39
40 int alphasort(const struct dirent **, const struct dirent **);
41 int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
42
43 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
44 #define DT_UNKNOWN 0
45 #define DT_FIFO 1
46 #define DT_CHR 2
47 #define DT_DIR 4
48 #define DT_BLK 6
49 #define DT_REG 8
50 #define DT_LNK 10
51 #define DT_SOCK 12
52 #define DT_WHT 14
53 #define IFTODT(x) ((x)>>12 & 017)
54 #define DTTOIF(x) ((x)<<12)
55 int getdents(int, struct dirent *, size_t);
56 #endif
57
58 #ifdef _GNU_SOURCE
59 int versionsort(const struct dirent **, const struct dirent **);
60 #endif
61
62 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
63 #define dirent64 dirent
64 #define readdir64 readdir
65 #define readdir64_r readdir_r
66 #define scandir64 scandir
67 #define alphasort64 alphasort
68 #define versionsort64 versionsort
69 #define off64_t off_t
70 #define ino64_t ino_t
71 #define getdents64 getdents
72 #endif
73
74 #ifdef __cplusplus
75 }
76 #endif
77
78 #endif