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