summaryrefslogtreecommitdiffstats
path: root/usr/include/dirent.h
blob: 43df503cd47f07d042356a7359f9615e7efbc87a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * dirent.h
 */

#ifndef _DIRENT_H
#define _DIRENT_H

#include <klibc/compiler.h>
#include <klibc/extern.h>
#include <klibc/sysconfig.h>
#include <sys/dirent.h>

struct _IO_dir {
	int __fd;

#ifdef __KLIBC_DIRENT_INTERNALS
	/* These fields for internal use only */

	size_t bytes_left;
	struct dirent *next;
	/* Declaring this as an array of struct enforces correct alignment */
	struct dirent buffer[_KLIBC_BUFSIZ / sizeof(struct dirent)];
#endif
};
typedef struct _IO_dir DIR;

__extern DIR *fdopendir(int);
__extern DIR *opendir(const char *);
__extern struct dirent *readdir(DIR *);
__extern int closedir(DIR *);
__static_inline int dirfd(DIR * __d)
{
	return __d->__fd;
}

__extern int scandir(const char *, struct dirent ***,
		     int (*)(const struct dirent *),
		     int (*)(const struct dirent **,
			     const struct dirent **));

__extern int alphasort(const struct dirent **, const struct dirent **);

#endif				/* _DIRENT_H */