aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/options/posix/include/dirent.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mlibc/options/posix/include/dirent.h')
-rw-r--r--lib/mlibc/options/posix/include/dirent.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/lib/mlibc/options/posix/include/dirent.h b/lib/mlibc/options/posix/include/dirent.h
new file mode 100644
index 0000000..b50566d
--- /dev/null
+++ b/lib/mlibc/options/posix/include/dirent.h
@@ -0,0 +1,76 @@
+
+#ifndef _DIRENT_H
+#define _DIRENT_H
+
+#include <abi-bits/ino_t.h>
+#include <bits/off_t.h>
+#include <bits/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define DT_UNKNOWN 0
+#define DT_FIFO 1
+#define DT_CHR 2
+#define DT_DIR 4
+#define DT_BLK 6
+#define DT_REG 8
+#define DT_LNK 10
+#define DT_SOCK 12
+#define DT_WHT 14
+
+#define __MLIBC_DIRENT_BODY ino_t d_ino; \
+ off_t d_off; \
+ unsigned short d_reclen; \
+ unsigned char d_type; \
+ char d_name[1024];
+
+struct dirent {
+ __MLIBC_DIRENT_BODY
+};
+
+struct dirent64 {
+ __MLIBC_DIRENT_BODY
+};
+
+#define d_fileno d_ino
+
+#undef __MLIBC_DIRENT_BODY
+
+#define IFTODT(mode) (((mode) & 0170000) >> 12)
+
+struct __mlibc_dir_struct {
+ int __handle;
+ __mlibc_size __ent_next;
+ __mlibc_size __ent_limit;
+ char __ent_buffer[2048];
+ struct dirent __current;
+};
+
+typedef struct __mlibc_dir_struct DIR;
+
+#ifndef __MLIBC_ABI_ONLY
+
+int alphasort(const struct dirent **, const struct dirent **);
+int closedir(DIR *);
+int dirfd(DIR *);
+DIR *fdopendir(int);
+DIR *opendir(const char *);
+struct dirent *readdir(DIR *);
+int readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict);
+void rewinddir(DIR *);
+int scandir(const char *, struct dirent ***, int (*)(const struct dirent *),
+ int (*)(const struct dirent **, const struct dirent **));
+void seekdir(DIR *, long);
+long telldir(DIR *);
+int versionsort(const struct dirent **, const struct dirent **);
+
+#endif /* !__MLIBC_ABI_ONLY */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _DIRENT_H
+