xref: /haiku/headers/posix/dirent.h (revision 51978af14a173e7fae0563b562be5603bc652aeb)
1 #ifndef _DIRENT_H
2 #define	_DIRENT_H
3 /*
4 ** Distributed under the terms of the OpenBeOS License.
5 */
6 
7 #include <sys/types.h>
8 
9 
10 typedef struct dirent {
11 	dev_t			d_dev;		/* device */
12 	dev_t			d_pdev;		/* parent device (only for queries) */
13 	ino_t			d_ino;		/* inode number */
14 	ino_t			d_pino;		/* parent inode (only for queries) */
15 	unsigned short	d_reclen;	/* length of this record, not the name */
16 	char			d_name[1];	/* name of the entry (null byte terminated) */
17 } dirent_t;
18 
19 typedef struct {
20 	int				fd;
21 	struct dirent	ent;
22 } DIR;
23 
24 #ifndef MAXNAMLEN
25 #	ifdef  NAME_MAX
26 #		define MAXNAMLEN NAME_MAX
27 #	else
28 #		define MAXNAMLEN 256
29 #	endif
30 #endif
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 DIR			 	*opendir(const char *dirname);
37 struct dirent	*readdir(DIR *dirp);
38 int				 closedir(DIR *dirp);
39 void			 rewinddir(DIR *dirp);
40 
41 #ifdef __cplusplus
42 }
43 #endif
44 
45 #endif /* _DIRENT_H */
46 
47