Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 04a7f78

Browse files
committedMar 28, 2022
Add implementation file.
1 parent 9ee46a6 commit 04a7f78

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
 
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include <__header_dirent.h>
2+
#include <__mode_t.h>
3+
4+
int __wasilibc_iftodt(int x) {
5+
switch (x) {
6+
case S_IFDIR: return DT_DIR;
7+
case S_IFCHR: return DT_CHR;
8+
case S_IFBLK: return DT_BLK;
9+
case S_IFREG: return DT_REG;
10+
case S_IFIFO: return DT_FIFO;
11+
case S_IFLNK: return DT_LNK;
12+
#ifdef DT_SOCK
13+
case S_IFSCK: return DT_SOCK;
14+
#endif
15+
case default: return DT_UNKNOWN;
16+
}
17+
}
18+
19+
int __wasilibc_dttoif(int x) {
20+
switch (x) {
21+
case DT_DIR: return S_IFDIR;
22+
case DT_CHR: return S_IFCHR;
23+
case DT_BLK: return S_IFBLK;
24+
case DT_REG: return S_IFREG;
25+
case DT_FIFO: return S_IFIFO;
26+
case DT_LNK: return S_IFLNK;
27+
#ifdef DT_SOCK
28+
case DT_SOCK: return S_IFSCK;
29+
#endif
30+
case DT_UNKNOWN: return S_IFSCK;
31+
}
32+
}

0 commit comments

Comments
 (0)
Please sign in to comment.