1#ifndef	_DIRENT_H
 2#define	_DIRENT_H
 3
 4#ifdef __cplusplus
 5extern "C" {
 6#endif
 7
 8#include <features.h>
 9
10#define __NEED_ino_t
11#define __NEED_off_t
12#define __NEED_size_t
13#define __NEED_ssize_t
14
15#include <bits/alltypes.h>
16
17#include <bits/dirent.h>
18
19typedef unsigned short reclen_t;
20
21struct posix_dent {
22	ino_t d_ino;
23	off_t d_off;
24	reclen_t d_reclen;
25	unsigned char d_type;
26	char d_name[];
27};
28
29typedef struct __dirstream DIR;
30
31#define d_fileno d_ino
32
33int            closedir(DIR *);
34DIR           *fdopendir(int);
35DIR           *opendir(const char *);
36struct dirent *readdir(DIR *);
37int            readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict);
38void           rewinddir(DIR *);
39int            dirfd(DIR *);
40
41ssize_t posix_getdents(int, void *, size_t, int);
42
43int alphasort(const struct dirent **, const struct dirent **);
44int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
45
46#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
47void           seekdir(DIR *, long);
48long           telldir(DIR *);
49#endif
50
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
61#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
62#define IFTODT(x) ((x)>>12 & 017)
63#define DTTOIF(x) ((x)<<12)
64int getdents(int, struct dirent *, size_t);
65#endif
66
67#ifdef _GNU_SOURCE
68int versionsort(const struct dirent **, const struct dirent **);
69#endif
70
71#if defined(_LARGEFILE64_SOURCE)
72#define dirent64 dirent
73#define readdir64 readdir
74#define readdir64_r readdir_r
75#define scandir64 scandir
76#define alphasort64 alphasort
77#define versionsort64 versionsort
78#define off64_t off_t
79#define ino64_t ino_t
80#define getdents64 getdents
81#endif
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif