1 #ifndef _SYS_DIRENT_H
2 # define _SYS_DIRENT_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 /*
9  * This file was written to be compatible with the BSD directory
10  * routines, so it looks like it.  But it was written from scratch.
11  * Sean Eric Fagan, sef@Kithrup.COM
12  *
13  *  Copied to RTEMS configuration without modification.
14  */
15 
16 typedef struct _dirdesc {
17 	int	dd_fd;
18 	long	dd_loc;
19 	long	dd_size;
20 	char	*dd_buf;
21 	int	dd_len;
22 	long	dd_seek;
23 } DIR;
24 
25 # define __dirfd(dp)	((dp)->dd_fd)
26 
27 DIR *opendir(const char *);
28 struct dirent *readdir(DIR *);
29 int readdir_r(DIR *__restrict, struct dirent *__restrict,
30               struct dirent **__restrict);
31 void rewinddir(DIR *);
32 int closedir(DIR *);
33 void seekdir(DIR *dir, long loc);
34 long telldir(DIR *dir);
35 
36 #ifdef _COMPILING_NEWLIB
37 void _seekdir(DIR *dir, long offset);
38 #endif
39 
40 #include <sys/types.h>
41 
42 #include <limits.h>
43 
44 struct dirent {
45 	long	d_ino;
46 	off_t	d_off;
47 	unsigned short	d_reclen;
48 	/* we need better syntax for variable-sized arrays */
49 	unsigned short	d_namlen;
50 	char		d_name[NAME_MAX + 1];
51 };
52 
53 int scandir ( const char *dirname,
54    struct dirent *** namelist,
55    int (*select)(const struct dirent *),
56    int (*dcomp)(const struct dirent **, const struct dirent **)
57 );
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 
63 
64 #endif
65