master
 1#include <__header_dirent.h>
 2#include <__mode_t.h>
 3
 4int __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_IFSOCK: return DT_SOCK;
14#endif
15        default: return DT_UNKNOWN;
16    }
17}
18
19int __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_IFSOCK;
29#endif
30        case DT_UNKNOWN:
31        default:
32	    return S_IFSOCK;
33    }
34}