summaryrefslogtreecommitdiffstats
path: root/libc-bottom-half/headers/public/__header_dirent.h
diff options
context:
space:
mode:
Diffstat (limited to 'libc-bottom-half/headers/public/__header_dirent.h')
-rw-r--r--libc-bottom-half/headers/public/__header_dirent.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/libc-bottom-half/headers/public/__header_dirent.h b/libc-bottom-half/headers/public/__header_dirent.h
index ccf3def..027fc07 100644
--- a/libc-bottom-half/headers/public/__header_dirent.h
+++ b/libc-bottom-half/headers/public/__header_dirent.h
@@ -11,12 +11,16 @@
#define DT_REG __WASI_FILETYPE_REGULAR_FILE
#define DT_UNKNOWN __WASI_FILETYPE_UNKNOWN
+// DT_SOCK is not supported in WASI Preview 1 (but will be in Preview 2). We
+// define it regardless so that libc++'s `<filesystem>` implementation builds.
+// The exact value is mostly arbitrary, but chosen so it doesn't conflict with
+// any of the existing `__WASI_FILETYPE_*` flags. We do not expect any new
+// flags to be added to WASI Preview 1, so that should be sufficient.
+#define DT_SOCK 20
+
#define IFTODT(x) (__wasilibc_iftodt(x))
#define DTTOIF(x) (__wasilibc_dttoif(x))
-int __wasilibc_iftodt(int x);
-int __wasilibc_dttoif(int x);
-
#include <__struct_dirent.h>
#include <__typedef_DIR.h>
@@ -24,6 +28,9 @@ int __wasilibc_dttoif(int x);
extern "C" {
#endif
+int __wasilibc_iftodt(int x);
+int __wasilibc_dttoif(int x);
+
int closedir(DIR *);
DIR *opendir(const char *);
DIR *fdopendir(int);